Write a short description about the course and add a link to your GitHub repository here. This is an R Markdown (.Rmd) file so you should use R Markdown syntax.
The text continues here.
I just solved the problem of uploading Rstudio to Github before writing chapter 1, thanks to the help of my classmate, I’m very happy to have solved this trouble!
I’m really looking forward to this course, after having studied QSR I’m really looking forward to continuing my in-depth study of R and analytics, and I also really like Kimmo’s course, so I’ve chosen this course.
The R for Health Data Science book was something I had already come across in the QSR and the second time through I was able to get to grips with some of the necessary commands in R. The parts that were difficult to understand before were now understandable and this was a very necessary process. The link: https://github.com/YuRenn/IODS-project
Describe the work you have done this week and summarize your learning. Data wrangling and analysis
1.read date set
learning2014 <- read.table("https://raw.githubusercontent.com/KimmoVehkalahti/Helsinki-Open-Data-Science/master/datasets/learning2014.txt",
sep = ",", header = T)
View(learning2014)
dim(learning2014)
## [1] 166 7
str(learning2014)
## 'data.frame': 166 obs. of 7 variables:
## $ gender : chr "F" "M" "F" "M" ...
## $ age : int 53 55 49 53 49 38 50 37 37 42 ...
## $ attitude: num 3.7 3.1 2.5 3.5 3.7 3.8 3.5 2.9 3.8 2.1 ...
## $ deep : num 3.58 2.92 3.5 3.5 3.67 ...
## $ stra : num 3.38 2.75 3.62 3.12 3.62 ...
## $ surf : num 2.58 3.17 2.25 2.25 2.83 ...
## $ points : int 25 12 24 10 22 21 21 31 24 26 ...
This data set is from international survey of Approaches to Learning, made possible by Teachers’ Academy funding for KV in 2013-2015. Before data wrangling, the data set has 183 observations and 60 variables. Then I did a data wrangling, and choose the variable of attitude, which is a sum of 10 questions related to students attitude towards statistics. In the dataset of learning2014, it has 166 observations and 7 variables, they are gender, age,attitude(Global attitude toward statistics), deep(deep learning), stra(strategical learning), surf(surface learning), and points(exam points).
3.Choose three variables as explanatory variables and fit a regression model where exam points is the target (dependent, outcome) variable. 3.1First, visualize the data set and create a plot matrix with ggpairs()
library(GGally)
## Loading required package: ggplot2
## Registered S3 method overwritten by 'GGally':
## method from
## +.gg ggplot2
library(ggplot2)
ggpairs(learning2014, lower = list(combo = wrap("facethist", bins = 20)))
3.2Choose attitude, points and surf as variables and fit a regression model
fit <- learning2014 %>%
lm(points ~ attitude + surf, data = .)
summary(fit)
##
## Call:
## lm(formula = points ~ attitude + surf, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -17.277 -3.236 0.386 3.977 10.642
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 14.1196 3.1271 4.515 1.21e-05 ***
## attitude 3.4264 0.5764 5.944 1.63e-08 ***
## surf -0.7790 0.7956 -0.979 0.329
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.32 on 163 degrees of freedom
## Multiple R-squared: 0.1953, Adjusted R-squared: 0.1854
## F-statistic: 19.78 on 2 and 163 DF, p-value: 2.041e-08
The result shows that expect surf, the p-values for the other variables are both significant and predictive. adjust R-squared shows that the model explains 18.54%.
3.3 remove the variable of surf, and fit the model again.
fit2 <- learning2014 %>%
lm(points ~ attitude, data = .)
summary(fit2)
##
## Call:
## lm(formula = points ~ attitude, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -16.9763 -3.2119 0.4339 4.1534 10.6645
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 11.6372 1.8303 6.358 1.95e-09 ***
## attitude 3.5255 0.5674 6.214 4.12e-09 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 5.32 on 164 degrees of freedom
## Multiple R-squared: 0.1906, Adjusted R-squared: 0.1856
## F-statistic: 38.61 on 1 and 164 DF, p-value: 4.119e-09
There is a strong correlation between the two variables and the model is a valid model. Adjusted R-squared indicates that the model can explain 18.54 of the variance, which is only 0.01% higher than fit1. A coefficient of 3.53 for attitude means that for every 1 increase in attitude, the test points will increase by 3.53.
4.Model diagnostic
library(ggfortify)
autoplot(fit2)
The Residuals vs fitted plot shows the data distributed up and down
along the blue line with no clear trend, indicating a linear
relationship.
prepare some packages
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ tibble 3.1.8 ✔ dplyr 1.0.10
## ✔ tidyr 1.2.1 ✔ stringr 1.4.1
## ✔ readr 2.1.3 ✔ forcats 0.5.2
## ✔ purrr 0.3.4
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(dplyr)
alc <- read_csv("alc.csv")
## Rows: 370 Columns: 35
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (17): school, sex, address, famsize, Pstatus, Mjob, Fjob, reason, guardi...
## dbl (17): age, Medu, Fedu, traveltime, studytime, famrel, freetime, goout, D...
## lgl (1): high_use
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
1.2 Print out the names of the variables in the data and describe the data set briefly
glimpse(alc)
## Rows: 370
## Columns: 35
## $ school <chr> "GP", "GP", "GP", "GP", "GP", "GP", "GP", "GP", "GP", "GP",…
## $ sex <chr> "F", "F", "F", "F", "F", "M", "M", "F", "M", "M", "F", "F",…
## $ age <dbl> 18, 17, 15, 15, 16, 16, 16, 17, 15, 15, 15, 15, 15, 15, 15,…
## $ address <chr> "U", "U", "U", "U", "U", "U", "U", "U", "U", "U", "U", "U",…
## $ famsize <chr> "GT3", "GT3", "LE3", "GT3", "GT3", "LE3", "LE3", "GT3", "LE…
## $ Pstatus <chr> "A", "T", "T", "T", "T", "T", "T", "A", "A", "T", "T", "T",…
## $ Medu <dbl> 4, 1, 1, 4, 3, 4, 2, 4, 3, 3, 4, 2, 4, 4, 2, 4, 4, 3, 3, 4,…
## $ Fedu <dbl> 4, 1, 1, 2, 3, 3, 2, 4, 2, 4, 4, 1, 4, 3, 2, 4, 4, 3, 2, 3,…
## $ Mjob <chr> "at_home", "at_home", "at_home", "health", "other", "servic…
## $ Fjob <chr> "teacher", "other", "other", "services", "other", "other", …
## $ reason <chr> "course", "course", "other", "home", "home", "reputation", …
## $ guardian <chr> "mother", "father", "mother", "mother", "father", "mother",…
## $ traveltime <dbl> 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, 3, 1, 1,…
## $ studytime <dbl> 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 3, 1, 3, 2, 1, 1,…
## $ schoolsup <chr> "yes", "no", "yes", "no", "no", "no", "no", "yes", "no", "n…
## $ famsup <chr> "no", "yes", "no", "yes", "yes", "yes", "no", "yes", "yes",…
## $ activities <chr> "no", "no", "no", "yes", "no", "yes", "no", "no", "no", "ye…
## $ nursery <chr> "yes", "no", "yes", "yes", "yes", "yes", "yes", "yes", "yes…
## $ higher <chr> "yes", "yes", "yes", "yes", "yes", "yes", "yes", "yes", "ye…
## $ internet <chr> "no", "yes", "yes", "yes", "no", "yes", "yes", "no", "yes",…
## $ romantic <chr> "no", "no", "no", "yes", "no", "no", "no", "no", "no", "no"…
## $ famrel <dbl> 4, 5, 4, 3, 4, 5, 4, 4, 4, 5, 3, 5, 4, 5, 4, 4, 3, 5, 5, 3,…
## $ freetime <dbl> 3, 3, 3, 2, 3, 4, 4, 1, 2, 5, 3, 2, 3, 4, 5, 4, 2, 3, 5, 1,…
## $ goout <dbl> 4, 3, 2, 2, 2, 2, 4, 4, 2, 1, 3, 2, 3, 3, 2, 4, 3, 2, 5, 3,…
## $ Dalc <dbl> 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1,…
## $ Walc <dbl> 1, 1, 3, 1, 2, 2, 1, 1, 1, 1, 2, 1, 3, 2, 1, 2, 2, 1, 4, 3,…
## $ health <dbl> 3, 3, 3, 5, 5, 5, 3, 1, 1, 5, 2, 4, 5, 3, 3, 2, 2, 4, 5, 5,…
## $ failures <dbl> 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,…
## $ paid <chr> "no", "no", "yes", "yes", "yes", "yes", "no", "no", "yes", …
## $ absences <dbl> 5, 3, 8, 1, 2, 8, 0, 4, 0, 0, 1, 2, 1, 1, 0, 5, 8, 3, 9, 5,…
## $ G1 <dbl> 2, 7, 10, 14, 8, 14, 12, 8, 16, 13, 12, 10, 13, 11, 14, 16,…
## $ G2 <dbl> 8, 8, 10, 14, 12, 14, 12, 9, 17, 14, 11, 12, 14, 11, 15, 16…
## $ G3 <dbl> 8, 8, 11, 14, 12, 14, 12, 10, 18, 14, 12, 12, 13, 12, 16, 1…
## $ alc_use <dbl> 1.0, 1.0, 2.5, 1.0, 1.5, 1.5, 1.0, 1.0, 1.0, 1.0, 1.5, 1.0,…
## $ high_use <lgl> FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALS…
The dataset has 370 observations and 35 variables. I will explain some meanings of variables: famsize-family size; Pstatus - parent’s cohabitation status; Medu - mother’s education; Fedu - father’s education; Mjob - mother’s job; Fjob - father’s job; reason - reason to choose this school; guardian - student’s guardian; schoolsup - extra educational support; famsup - family educational support; activities - extra-curricular activities; nursery - attended nursery school; higher - wants to take higher education; internet - Internet access at home; romantic - with a romantic relationship; famrel - quality of family relationships; freetime - free time after school; goout - going out with friends; Dalc - workday alcohol consumption; Walc - weekend alcohol consumption; health - current health status; absences - number of school absences; G1 - first period grade; G2 - second period grade; G3 - final grade.
3.Explore the distributions of variables and their relationships with alcohol consumption
alc %>% group_by(freetime) %>% summarise(count = n())
## # A tibble: 5 × 2
## freetime count
## <dbl> <int>
## 1 1 17
## 2 2 60
## 3 3 152
## 4 4 105
## 5 5 36
alc %>% group_by(goout) %>% summarise(count = n())
## # A tibble: 5 × 2
## goout count
## <dbl> <int>
## 1 1 22
## 2 2 97
## 3 3 120
## 4 4 78
## 5 5 53
alc %>% group_by(famrel) %>% summarise(count = n())
## # A tibble: 5 × 2
## famrel count
## <dbl> <int>
## 1 1 8
## 2 2 18
## 3 3 64
## 4 4 180
## 5 5 100
alc %>% group_by(absences) %>% summarise(count = n())
## # A tibble: 26 × 2
## absences count
## <dbl> <int>
## 1 0 63
## 2 1 50
## 3 2 56
## 4 3 38
## 5 4 35
## 6 5 22
## 7 6 21
## 8 7 12
## 9 8 20
## 10 9 11
## # … with 16 more rows
The distribution of the freetime and goout variables is more in the middle, with the family relationship variables mostly distributed between 3 and 5, indicating that the majority of students have good family relationships; classroom absences, the majority of students are absent 5 times or less.
3.1 explore alcohol high use and freetime
p1 <- alc %>%
ggplot(aes(x = freetime, fill = high_use)) +
geom_bar(position = "fill", color ="white") +
labs(x = "free time after school", y = "alcohol high-user",
title = "Proportion of alcohol high-use by freetime")+
theme(legend.position = "bottom")+
scale_fill_discrete(labels = c("FALSE" = "Non-high-user",
"TRUE" = "high-user"))+
scale_fill_brewer(palette = "")
## Warning in pal_name(palette, type): Unknown palette
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
p1
According to the proportions shown in the bar chart, the proportion of
alcohol use increases gradually as leisure time after school
increases.
3.2 explore alcohol high use and goout
p2 <- alc %>%
ggplot(aes(x = goout, fill = high_use)) +
geom_bar(position = "fill", color ="white") +
labs(x = "going out with friends", y = "alcohol high-user",
title = "Proportion of alcohol high-use by goout")+
theme(legend.position = "bottom")+
scale_fill_discrete(labels = c("FALSE" = "Non-high-user",
"TRUE" = "high-user"))+
scale_fill_brewer(palette = "")
## Warning in pal_name(palette, type): Unknown palette
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
p2
According to the bar scale, the proportion of alcohol consumption
increases as the number of outings with friends increases, particularly
at level 4 of the outing degree, where the proportion increases
substantially.
3.3explore alcohol high use and famrel
p3 <- alc %>%
ggplot(aes(x = famrel, fill = high_use)) +
geom_bar(position = "fill", color ="white") +
labs(x = "quality of family relationships", y = "alcohol high-user",
title = "Proportion of alcohol high-use by family relationship")+
theme(legend.position = "bottom")+
scale_fill_discrete(labels = c("FALSE" = "Non-high-user",
"TRUE" = "high-user"))+
scale_fill_brewer(palette = "")
## Warning in pal_name(palette, type): Unknown palette
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
p3
“famrel - quality of family relationships (numeric: from 1 - very bad to
5 - excellent)” Family relationships start at level 3, with better
family relationships being accompanied by a lower proportion of alcohol
consumption. The highest proportion of alcohol consumption is found when
family relationships are poor.
3.4 explore alcohol high use and absences
p4 <- alc %>%
ggplot(aes(x = absences, fill = high_use)) +
geom_bar(position = "fill", color ="white") +
labs(x = " number of school absences (numeric: from 0 to 93)", y = "alcohol high-user",
title = "Proportion of alcohol high-use by number of school absences")+
theme(legend.position = "bottom")+
scale_fill_discrete(labels = c("FALSE" = "Non-high-user",
"TRUE" = "high-user"))+
scale_fill_brewer(palette = "")
## Warning in pal_name(palette, type): Unknown palette
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
p4
As the number of absences from school increases, the proportion of
alcohol consumption increases with it. The bars show much the same
results as I expected, the only differences being family relationships
and alcohol consumption rates, with the worst families not having the
highest rates of alcohol consumption and the second worst families
having the highest rates of alcohol consumption.
4.logistic regression model 4.1
m1 <- glm(high_use ~ freetime + goout + famrel + absences, data = alc, family = "binomial")
summary(m1)
##
## Call:
## glm(formula = high_use ~ freetime + goout + famrel + absences,
## family = "binomial", data = alc)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.8393 -0.7676 -0.5200 0.9080 2.3909
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.7391 0.6975 -3.927 8.6e-05 ***
## freetime 0.2283 0.1393 1.639 0.101292
## goout 0.7103 0.1252 5.673 1.4e-08 ***
## famrel -0.4019 0.1387 -2.898 0.003754 **
## absences 0.0761 0.0220 3.459 0.000543 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 452.04 on 369 degrees of freedom
## Residual deviance: 380.08 on 365 degrees of freedom
## AIC: 390.08
##
## Number of Fisher Scoring iterations: 4
There is a highly significant relationship between the proportion of increased drinking and family relationships, the frequency of going out with friends and absence from class, but a non-significant p-value between this and free time.
4.2 From coefficients to odds ratios
m1 <- glm(high_use ~ freetime + goout + famrel + absences, data = alc, family = "binomial")
# compute odds ratios (OR)
OR <- coef(m1) %>% exp
OR
## (Intercept) freetime goout famrel absences
## 0.06462506 1.25649062 2.03450512 0.66907685 1.07907060
# compute confidence intervals (CI)
confint(m1)
## Waiting for profiling to be done...
## 2.5 % 97.5 %
## (Intercept) -4.14545349 -1.4024140
## freetime -0.04305995 0.5046433
## goout 0.47111595 0.9630772
## famrel -0.67730666 -0.1316918
## absences 0.03387575 0.1213892
CI <- exp(confint(m1))
## Waiting for profiling to be done...
CI
## 2.5 % 97.5 %
## (Intercept) 0.01583625 0.2460024
## freetime 0.95785396 1.6563946
## goout 1.60178070 2.6197457
## famrel 0.50798332 0.8766111
## absences 1.03445607 1.1290642
# print out the odds ratios with their confidence intervals
cbind(OR, CI)
## OR 2.5 % 97.5 %
## (Intercept) 0.06462506 0.01583625 0.2460024
## freetime 1.25649062 0.95785396 1.6563946
## goout 2.03450512 1.60178070 2.6197457
## famrel 0.66907685 0.50798332 0.8766111
## absences 1.07907060 1.03445607 1.1290642
According to the model, the probability of drinking increases 1.26 times for every doubling of free time, 2.03 times for more frequent outings with friends, 0.67 times for every unit of improvement in family relations, and 1.08 times for every increase in absenteeism from school.
prob <- predict(m1, type = "response")
library(dplyr)
alc <- mutate(alc, probability = prob)
alc <- mutate(alc, prediction = probability > 0.5)
table(high_use = alc$high_use, prediction = alc$prediction)
## prediction
## high_use FALSE TRUE
## FALSE 239 20
## TRUE 67 44
Of the 370 participants, there are 259 non-alcoholics, of which the model correctly predicted 239 (92.28%); of the 111 alcoholics, the model successfully predicted 44 (39.64%).
5.2 Binary predictions (2)
library(dplyr); library(ggplot2)
# initialize a plot of 'high_use' versus 'probabilities' in 'alc'
g <- ggplot(alc, aes(x = probability, y = high_use))
# define the geom as points and draw the plot
g+aes(color = prediction, shape = prediction) + geom_point()
# tabulate the target variable versus the predictions
table(high_use = alc$high_use, prediction = alc$prediction)
## prediction
## high_use FALSE TRUE
## FALSE 239 20
## TRUE 67 44
6.Bonus
# define a loss function (mean prediction error)
loss_func <- function(class, prob) {
n_wrong <- abs(class - prob) > 0.5
mean(n_wrong)
}
training.error.full <- loss_func(alc$high_use, alc$probability)
training.error.full
## [1] 0.2351351
Prediction error rate of 23.51%.
library(MASS)
##
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
##
## select
library(corrplot)
## corrplot 0.92 loaded
library(tidyverse)
data("Boston")
1,1 explore the structure and the dimensions of the data
#explore the structure
str(Boston)
## 'data.frame': 506 obs. of 14 variables:
## $ crim : num 0.00632 0.02731 0.02729 0.03237 0.06905 ...
## $ zn : num 18 0 0 0 0 0 12.5 12.5 12.5 12.5 ...
## $ indus : num 2.31 7.07 7.07 2.18 2.18 2.18 7.87 7.87 7.87 7.87 ...
## $ chas : int 0 0 0 0 0 0 0 0 0 0 ...
## $ nox : num 0.538 0.469 0.469 0.458 0.458 0.458 0.524 0.524 0.524 0.524 ...
## $ rm : num 6.58 6.42 7.18 7 7.15 ...
## $ age : num 65.2 78.9 61.1 45.8 54.2 58.7 66.6 96.1 100 85.9 ...
## $ dis : num 4.09 4.97 4.97 6.06 6.06 ...
## $ rad : int 1 2 2 3 3 3 5 5 5 5 ...
## $ tax : num 296 242 242 222 222 222 311 311 311 311 ...
## $ ptratio: num 15.3 17.8 17.8 18.7 18.7 18.7 15.2 15.2 15.2 15.2 ...
## $ black : num 397 397 393 395 397 ...
## $ lstat : num 4.98 9.14 4.03 2.94 5.33 ...
## $ medv : num 24 21.6 34.7 33.4 36.2 28.7 22.9 27.1 16.5 18.9 ...
#explore the dimensions#
dim(Boston)
## [1] 506 14
This dataset has 506 observations and 14 variables. And the variable crim = per capita crime rate by town; zn = proportion of residential land zoned for lots over 25,000 sq.ft; indus = proportion of non-retail business acres per town; chas = Charles River dummy variable (= 1 if tract bounds river; 0 otherwise); nox = nitrogen oxides concentration (parts per 10 million); rm = average number of rooms per dwelling; dis = weighted mean of distances to five Boston employment centres; rad = index of accessibility to radial highways; tax = full-value property-tax rate per $10,000; ptratio = pupil-teacher ratio by town; black = 1000(Bk - 0.63)^2 where Bk is the proportion of blacks by town; lstat = lower status of the population (percent); medv = median value of owner-occupied homes in $1000s.
2.Show a graphical overview of the data and show summaries of the variables in the data.
# plot matrix of the variables
pairs(Boston)
# calculate the correlation matrix and round it
cor_matrix <- cor(Boston)
# print the correlation matrix
cor_matrix
## crim zn indus chas nox
## crim 1.00000000 -0.20046922 0.40658341 -0.055891582 0.42097171
## zn -0.20046922 1.00000000 -0.53382819 -0.042696719 -0.51660371
## indus 0.40658341 -0.53382819 1.00000000 0.062938027 0.76365145
## chas -0.05589158 -0.04269672 0.06293803 1.000000000 0.09120281
## nox 0.42097171 -0.51660371 0.76365145 0.091202807 1.00000000
## rm -0.21924670 0.31199059 -0.39167585 0.091251225 -0.30218819
## age 0.35273425 -0.56953734 0.64477851 0.086517774 0.73147010
## dis -0.37967009 0.66440822 -0.70802699 -0.099175780 -0.76923011
## rad 0.62550515 -0.31194783 0.59512927 -0.007368241 0.61144056
## tax 0.58276431 -0.31456332 0.72076018 -0.035586518 0.66802320
## ptratio 0.28994558 -0.39167855 0.38324756 -0.121515174 0.18893268
## black -0.38506394 0.17552032 -0.35697654 0.048788485 -0.38005064
## lstat 0.45562148 -0.41299457 0.60379972 -0.053929298 0.59087892
## medv -0.38830461 0.36044534 -0.48372516 0.175260177 -0.42732077
## rm age dis rad tax ptratio
## crim -0.21924670 0.35273425 -0.37967009 0.625505145 0.58276431 0.2899456
## zn 0.31199059 -0.56953734 0.66440822 -0.311947826 -0.31456332 -0.3916785
## indus -0.39167585 0.64477851 -0.70802699 0.595129275 0.72076018 0.3832476
## chas 0.09125123 0.08651777 -0.09917578 -0.007368241 -0.03558652 -0.1215152
## nox -0.30218819 0.73147010 -0.76923011 0.611440563 0.66802320 0.1889327
## rm 1.00000000 -0.24026493 0.20524621 -0.209846668 -0.29204783 -0.3555015
## age -0.24026493 1.00000000 -0.74788054 0.456022452 0.50645559 0.2615150
## dis 0.20524621 -0.74788054 1.00000000 -0.494587930 -0.53443158 -0.2324705
## rad -0.20984667 0.45602245 -0.49458793 1.000000000 0.91022819 0.4647412
## tax -0.29204783 0.50645559 -0.53443158 0.910228189 1.00000000 0.4608530
## ptratio -0.35550149 0.26151501 -0.23247054 0.464741179 0.46085304 1.0000000
## black 0.12806864 -0.27353398 0.29151167 -0.444412816 -0.44180801 -0.1773833
## lstat -0.61380827 0.60233853 -0.49699583 0.488676335 0.54399341 0.3740443
## medv 0.69535995 -0.37695457 0.24992873 -0.381626231 -0.46853593 -0.5077867
## black lstat medv
## crim -0.38506394 0.4556215 -0.3883046
## zn 0.17552032 -0.4129946 0.3604453
## indus -0.35697654 0.6037997 -0.4837252
## chas 0.04878848 -0.0539293 0.1752602
## nox -0.38005064 0.5908789 -0.4273208
## rm 0.12806864 -0.6138083 0.6953599
## age -0.27353398 0.6023385 -0.3769546
## dis 0.29151167 -0.4969958 0.2499287
## rad -0.44441282 0.4886763 -0.3816262
## tax -0.44180801 0.5439934 -0.4685359
## ptratio -0.17738330 0.3740443 -0.5077867
## black 1.00000000 -0.3660869 0.3334608
## lstat -0.36608690 1.0000000 -0.7376627
## medv 0.33346082 -0.7376627 1.0000000
# visualize the correlation matrix
library(corrplot)
corrplot(cor_matrix, method="circle")
From the correlation matrix, it is possible to look for relationships
between different variables, using the variable dis as an example, the
weighted average of distances to the five employment centres in Boston
and the variable indus (proportion of non-retail commercial acres in
each town) show a very strong negative correlation; with nox (nitrogen
oxide concentration) also a strong negative correlation; and with age
again a strong negative correlation. There is a relatively strong
positive correlation with zn (the proportion of residential land over
25,000 square feet).
#summaries of the variables in the data
summary(Boston)
## crim zn indus chas
## Min. : 0.00632 Min. : 0.00 Min. : 0.46 Min. :0.00000
## 1st Qu.: 0.08205 1st Qu.: 0.00 1st Qu.: 5.19 1st Qu.:0.00000
## Median : 0.25651 Median : 0.00 Median : 9.69 Median :0.00000
## Mean : 3.61352 Mean : 11.36 Mean :11.14 Mean :0.06917
## 3rd Qu.: 3.67708 3rd Qu.: 12.50 3rd Qu.:18.10 3rd Qu.:0.00000
## Max. :88.97620 Max. :100.00 Max. :27.74 Max. :1.00000
## nox rm age dis
## Min. :0.3850 Min. :3.561 Min. : 2.90 Min. : 1.130
## 1st Qu.:0.4490 1st Qu.:5.886 1st Qu.: 45.02 1st Qu.: 2.100
## Median :0.5380 Median :6.208 Median : 77.50 Median : 3.207
## Mean :0.5547 Mean :6.285 Mean : 68.57 Mean : 3.795
## 3rd Qu.:0.6240 3rd Qu.:6.623 3rd Qu.: 94.08 3rd Qu.: 5.188
## Max. :0.8710 Max. :8.780 Max. :100.00 Max. :12.127
## rad tax ptratio black
## Min. : 1.000 Min. :187.0 Min. :12.60 Min. : 0.32
## 1st Qu.: 4.000 1st Qu.:279.0 1st Qu.:17.40 1st Qu.:375.38
## Median : 5.000 Median :330.0 Median :19.05 Median :391.44
## Mean : 9.549 Mean :408.2 Mean :18.46 Mean :356.67
## 3rd Qu.:24.000 3rd Qu.:666.0 3rd Qu.:20.20 3rd Qu.:396.23
## Max. :24.000 Max. :711.0 Max. :22.00 Max. :396.90
## lstat medv
## Min. : 1.73 Min. : 5.00
## 1st Qu.: 6.95 1st Qu.:17.02
## Median :11.36 Median :21.20
## Mean :12.65 Mean :22.53
## 3rd Qu.:16.95 3rd Qu.:25.00
## Max. :37.97 Max. :50.00
# center and standardize variables
boston_scaled <- scale(Boston)
# summaries of the scaled variables
summary(boston_scaled)
## crim zn indus chas
## Min. :-0.419367 Min. :-0.48724 Min. :-1.5563 Min. :-0.2723
## 1st Qu.:-0.410563 1st Qu.:-0.48724 1st Qu.:-0.8668 1st Qu.:-0.2723
## Median :-0.390280 Median :-0.48724 Median :-0.2109 Median :-0.2723
## Mean : 0.000000 Mean : 0.00000 Mean : 0.0000 Mean : 0.0000
## 3rd Qu.: 0.007389 3rd Qu.: 0.04872 3rd Qu.: 1.0150 3rd Qu.:-0.2723
## Max. : 9.924110 Max. : 3.80047 Max. : 2.4202 Max. : 3.6648
## nox rm age dis
## Min. :-1.4644 Min. :-3.8764 Min. :-2.3331 Min. :-1.2658
## 1st Qu.:-0.9121 1st Qu.:-0.5681 1st Qu.:-0.8366 1st Qu.:-0.8049
## Median :-0.1441 Median :-0.1084 Median : 0.3171 Median :-0.2790
## Mean : 0.0000 Mean : 0.0000 Mean : 0.0000 Mean : 0.0000
## 3rd Qu.: 0.5981 3rd Qu.: 0.4823 3rd Qu.: 0.9059 3rd Qu.: 0.6617
## Max. : 2.7296 Max. : 3.5515 Max. : 1.1164 Max. : 3.9566
## rad tax ptratio black
## Min. :-0.9819 Min. :-1.3127 Min. :-2.7047 Min. :-3.9033
## 1st Qu.:-0.6373 1st Qu.:-0.7668 1st Qu.:-0.4876 1st Qu.: 0.2049
## Median :-0.5225 Median :-0.4642 Median : 0.2746 Median : 0.3808
## Mean : 0.0000 Mean : 0.0000 Mean : 0.0000 Mean : 0.0000
## 3rd Qu.: 1.6596 3rd Qu.: 1.5294 3rd Qu.: 0.8058 3rd Qu.: 0.4332
## Max. : 1.6596 Max. : 1.7964 Max. : 1.6372 Max. : 0.4406
## lstat medv
## Min. :-1.5296 Min. :-1.9063
## 1st Qu.:-0.7986 1st Qu.:-0.5989
## Median :-0.1811 Median :-0.1449
## Mean : 0.0000 Mean : 0.0000
## 3rd Qu.: 0.6024 3rd Qu.: 0.2683
## Max. : 3.5453 Max. : 2.9865
# class of the boston_scaled object
class(boston_scaled)
## [1] "matrix" "array"
# change the object to data frame
boston_scaled <- as.data.frame(boston_scaled)
boston_scaled
## crim zn indus chas nox rm
## 1 -0.419366929 0.28454827 -1.28663623 -0.2723291 -0.14407485 0.413262920
## 2 -0.416926670 -0.48724019 -0.59279438 -0.2723291 -0.73953036 0.194082387
## 3 -0.416928995 -0.48724019 -0.59279438 -0.2723291 -0.73953036 1.281445551
## 4 -0.416338404 -0.48724019 -1.30558569 -0.2723291 -0.83445805 1.015297761
## 5 -0.412074053 -0.48724019 -1.30558569 -0.2723291 -0.83445805 1.227362043
## 6 -0.416631374 -0.48724019 -1.30558569 -0.2723291 -0.83445805 0.206891639
## 7 -0.409837246 0.04872402 -0.47618230 -0.2723291 -0.26489191 -0.388026950
## 8 -0.403296561 0.04872402 -0.47618230 -0.2723291 -0.26489191 -0.160306916
## 9 -0.395543302 0.04872402 -0.47618230 -0.2723291 -0.26489191 -0.930285282
## 10 -0.400333140 0.04872402 -0.47618230 -0.2723291 -0.26489191 -0.399412952
## 11 -0.393956378 0.04872402 -0.47618230 -0.2723291 -0.26489191 0.131459378
## 12 -0.406444832 0.04872402 -0.47618230 -0.2723291 -0.26489191 -0.392296701
## 13 -0.409198989 0.04872402 -0.47618230 -0.2723291 -0.26489191 -0.563086727
## 14 -0.346886928 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.477691714
## 15 -0.345933611 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.268473932
## 16 -0.347162460 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.641365488
## 17 -0.297573695 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.497617217
## 18 -0.328932014 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.419338455
## 19 -0.326780075 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -1.179354069
## 20 -0.335721492 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.793653261
## 21 -0.274570851 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -1.017103545
## 22 -0.321045059 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.454919710
## 23 -0.276816959 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.203004422
## 24 -0.305188606 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.671253743
## 25 -0.332877817 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.513272969
## 26 -0.322382028 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.975829289
## 27 -0.341986646 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.671253743
## 28 -0.308985598 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.338213193
## 29 -0.330235268 -0.48724019 -0.43682573 -0.2723291 -0.14407485 0.299402903
## 30 -0.303558666 -0.48724019 -0.43682573 -0.2723291 -0.14407485 0.554164692
## 31 -0.288635766 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.813578764
## 32 -0.262604396 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.302631937
## 33 -0.258736486 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.476268464
## 34 -0.286204807 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.830657767
## 35 -0.232598159 -0.48724019 -0.43682573 -0.2723291 -0.14407485 -0.268473932
## 36 -0.412641393 -0.48724019 -0.75459363 -0.2723291 -0.48063666 -0.500463717
## 37 -0.408773484 -0.48724019 -0.75459363 -0.2723291 -0.48063666 -0.631402737
## 38 -0.410784750 -0.48724019 -0.75459363 -0.2723291 -0.48063666 -0.618593485
## 39 -0.399750686 -0.48724019 -0.75459363 -0.2723291 -0.48063666 -0.453496460
## 40 -0.416889467 2.72854505 -1.19334657 -0.2723291 -1.09335175 0.441727925
## 41 -0.416196569 2.72854505 -1.19334657 -0.2723291 -1.09335175 1.052302267
## 42 -0.405285738 -0.48724019 -0.61611679 -0.2723291 -0.92075595 0.690796712
## 43 -0.403651148 -0.48724019 -0.61611679 -0.2723291 -0.92075595 -0.164576667
## 44 -0.401574777 -0.48724019 -0.61611679 -0.2723291 -0.92075595 -0.104800158
## 45 -0.405837965 -0.48724019 -0.61611679 -0.2723291 -0.92075595 -0.306901688
## 46 -0.400172703 -0.48724019 -0.61611679 -0.2723291 -0.92075595 -0.857699521
## 47 -0.398203290 -0.48724019 -0.61611679 -0.2723291 -0.92075595 -0.709681499
## 48 -0.393447167 -0.48724019 -0.61611679 -0.2723291 -0.92075595 -0.362408446
## 49 -0.390587216 -0.48724019 -0.61611679 -0.2723291 -0.92075595 -1.260479332
## 50 -0.394551620 -0.48724019 -0.61611679 -0.2723291 -0.92075595 -0.971559538
## 51 -0.409786092 0.41317968 -0.80123846 -0.2723291 -0.99842406 -0.457766211
## 52 -0.415059564 0.41317968 -0.80123846 -0.2723291 -0.99842406 -0.241432178
## 53 -0.413870242 0.41317968 -0.80123846 -0.2723291 -0.99842406 0.322174907
## 54 -0.414310861 0.41317968 -0.80123846 -0.2723291 -0.99842406 -0.407952453
## 55 -0.418520570 2.72854505 -1.04029322 -0.2723291 -1.24868797 -0.564509977
## 56 -0.418577536 3.37170210 -1.44552019 -0.2723291 -1.30909650 1.372533565
## 57 -0.417712575 3.15731641 -1.51548743 -0.2723291 -1.24868797 0.139998879
## 58 -0.418436864 3.80047346 -1.43094368 -0.2723291 -1.24005818 0.756266222
## 59 -0.402145605 0.58468822 -0.87557866 -0.2723291 -0.87760700 -0.198734672
## 60 -0.408094536 0.58468822 -0.87557866 -0.2723291 -0.87760700 -0.509003218
## 61 -0.402742009 0.58468822 -0.87557866 -0.2723291 -0.87760700 -0.773727758
## 62 -0.400138988 0.58468822 -0.87557866 -0.2723291 -0.87760700 -0.453496460
## 63 -0.407281891 0.58468822 -0.87557866 -0.2723291 -0.87760700 0.243896145
## 64 -0.405395021 0.58468822 -0.87557866 -0.2723291 -0.87760700 0.679410711
## 65 -0.417833484 0.26310970 -1.42219777 -0.2723291 -1.19604625 1.166162284
## 66 -0.415934988 2.94293073 -1.13212523 -0.2723291 -1.35224545 0.007636609
## 67 -0.415010735 2.94293073 -1.13212523 -0.2723291 -1.35224545 -0.708258248
## 68 -0.413371495 0.04872402 -0.73855947 -0.2723291 -1.25731776 -0.578742479
## 69 -0.404344047 0.04872402 -0.73855947 -0.2723291 -1.25731776 -0.982945540
## 70 -0.405202032 0.04872402 -0.73855947 -0.2723291 -1.25731776 -0.568779727
## 71 -0.409840734 -0.48724019 -0.04763292 -0.2723291 -1.22279860 0.188389387
## 72 -0.401644532 -0.48724019 -0.04763292 -0.2723291 -1.22279860 -0.460612711
## 73 -0.409447781 -0.48724019 -0.04763292 -0.2723291 -1.22279860 -0.312594689
## 74 -0.397385995 -0.48724019 -0.04763292 -0.2723291 -1.22279860 -0.056409650
## 75 -0.410921935 -0.48724019 0.24681257 -0.2723291 -1.01568364 -0.016558644
## 76 -0.409043203 -0.48724019 0.24681257 -0.2723291 -1.01568364 0.001943608
## 77 -0.408297988 -0.48724019 0.24681257 -0.2723291 -1.01568364 -0.008019143
## 78 -0.409979081 -0.48724019 0.24681257 -0.2723291 -1.01568364 -0.205850923
## 79 -0.413537744 -0.48724019 0.24681257 -0.2723291 -1.01568364 -0.074911903
## 80 -0.410351107 -0.48724019 0.24681257 -0.2723291 -1.01568364 -0.584435480
## 81 -0.415319982 0.58468822 -0.91493524 -0.2723291 -1.11061133 0.629596953
## 82 -0.414914241 0.58468822 -0.91493524 -0.2723291 -1.11061133 0.475885930
## 83 -0.415847794 0.58468822 -0.91493524 -0.2723291 -1.11061133 0.024715612
## 84 -0.415973353 0.58468822 -0.91493524 -0.2723291 -1.11061133 -0.167423167
## 85 -0.414220179 -0.48724019 -0.96886832 -0.2723291 -0.91212616 0.148538381
## 86 -0.413434274 -0.48724019 -0.96886832 -0.2723291 -0.91212616 0.491541682
## 87 -0.414070206 -0.48724019 -0.96886832 -0.2723291 -0.91212616 -0.383757200
## 88 -0.411788058 -0.48724019 -0.96886832 -0.2723291 -0.91212616 -0.232892677
## 89 -0.413521468 -0.48724019 -1.12629463 -0.2723291 -0.56693456 1.028107013
## 90 -0.413937672 -0.48724019 -1.12629463 -0.2723291 -0.56693456 1.130581029
## 91 -0.414656148 -0.48724019 -1.12629463 -0.2723291 -0.56693456 0.188389387
## 92 -0.415530409 -0.48724019 -1.12629463 -0.2723291 -0.56693456 0.171310384
## 93 -0.415215350 0.71331963 0.56895343 -0.2723291 -0.78267931 0.223970642
## 94 -0.416759258 0.71331963 0.56895343 -0.2723291 -0.78267931 -0.104800158
## 95 -0.415109555 0.71331963 0.56895343 -0.2723291 -0.78267931 -0.050716649
## 96 -0.405913532 -0.48724019 -1.20209248 -0.2723291 -0.94664532 0.484425431
## 97 -0.406727340 -0.48724019 -1.20209248 -0.2723291 -0.94664532 -0.173116168
## 98 -0.406054205 -0.48724019 -1.20209248 -0.2723291 -0.94664532 2.539598741
## 99 -0.410583624 -0.48724019 -1.20209248 -0.2723291 -0.94664532 2.185209437
## 100 -0.412126370 -0.48724019 -1.20209248 -0.2723291 -0.94664532 1.610216351
## 101 -0.402818740 -0.48724019 -0.37560439 -0.2723291 -0.29941107 0.629596953
## 102 -0.406811046 -0.48724019 -0.37560439 -0.2723291 -0.29941107 0.706452465
## 103 -0.393506459 -0.48724019 -0.37560439 -0.2723291 -0.29941107 0.171310384
## 104 -0.395500287 -0.48724019 -0.37560439 -0.2723291 -0.29941107 -0.210120673
## 105 -0.403872039 -0.48724019 -0.37560439 -0.2723291 -0.29941107 -0.167423167
## 106 -0.404683521 -0.48724019 -0.37560439 -0.2723291 -0.29941107 -0.617170235
## 107 -0.400198280 -0.48724019 -0.37560439 -0.2723291 -0.29941107 -0.638518988
## 108 -0.404852095 -0.48724019 -0.37560439 -0.2723291 -0.29941107 -0.224353176
## 109 -0.405218308 -0.48724019 -0.37560439 -0.2723291 -0.29941107 0.269514649
## 110 -0.389452536 -0.48724019 -0.37560439 -0.2723291 -0.29941107 -0.079181654
## 111 -0.407553935 -0.48724019 -0.37560439 -0.2723291 -0.29941107 -0.127572161
## 112 -0.408378206 -0.48724019 -0.16424500 -0.2723291 -0.06640675 0.612517950
## 113 -0.405768210 -0.48724019 -0.16424500 -0.2723291 -0.06640675 -0.528928721
## 114 -0.394278413 -0.48724019 -0.16424500 -0.2723291 -0.06640675 -0.274166933
## 115 -0.403556979 -0.48724019 -0.16424500 -0.2723291 -0.06640675 -0.043600398
## 116 -0.400182004 -0.48724019 -0.16424500 -0.2723291 -0.06640675 -0.507579968
## 117 -0.404804429 -0.48724019 -0.16424500 -0.2723291 -0.06640675 -0.154613915
## 118 -0.402549021 -0.48724019 -0.16424500 -0.2723291 -0.06640675 -0.375217698
## 119 -0.404920687 -0.48724019 -0.16424500 -0.2723291 -0.06640675 -0.587281980
## 120 -0.403272146 -0.48724019 -0.16424500 -0.2723291 -0.06640675 -0.787960260
## 121 -0.412081029 -0.48724019 2.11552109 -0.2723291 0.22700611 -0.590128481
## 122 -0.411771782 -0.48724019 2.11552109 -0.2723291 0.22700611 -0.399412952
## 123 -0.409290833 -0.48724019 2.11552109 -0.2723291 0.22700611 -0.460612711
## 124 -0.402618775 -0.48724019 2.11552109 -0.2723291 0.22700611 -0.610053984
## 125 -0.408651413 -0.48724019 2.11552109 -0.2723291 0.22700611 -0.577319229
## 126 -0.400451723 -0.48724019 2.11552109 -0.2723291 0.22700611 -0.425031456
## 127 -0.375069074 -0.48724019 2.11552109 -0.2723291 0.22700611 -0.955903786
## 128 -0.389973373 -0.48724019 1.56744433 -0.2723291 0.59808708 -0.842043769
## 129 -0.382267781 -0.48724019 1.56744433 -0.2723291 0.59808708 0.208314890
## 130 -0.317649158 -0.48724019 1.56744433 -0.2723291 0.59808708 -0.921745781
## 131 -0.380566923 -0.48724019 1.56744433 -0.2723291 0.59808708 0.246742645
## 132 -0.281412645 -0.48724019 1.56744433 -0.2723291 0.59808708 0.058873617
## 133 -0.351503540 -0.48724019 1.56744433 -0.2723291 0.59808708 0.124343127
## 134 -0.381757407 -0.48724019 1.56744433 -0.2723291 0.59808708 -0.658444491
## 135 -0.306613931 -0.48724019 1.56744433 -0.2723291 0.59808708 -0.750955755
## 136 -0.355255192 -0.48724019 1.56744433 -0.2723291 0.59808708 0.071682869
## 137 -0.382592141 -0.48724019 1.56744433 -0.2723291 0.59808708 -0.487654465
## 138 -0.379140436 -0.48724019 1.56744433 -0.2723291 0.59808708 0.241049645
## 139 -0.391060387 -0.48724019 1.56744433 -0.2723291 0.59808708 -0.608630733
## 140 -0.356796775 -0.48724019 1.56744433 -0.2723291 0.59808708 -0.190195170
## 141 -0.386282176 -0.48724019 1.56744433 -0.2723291 0.59808708 -0.157460416
## 142 -0.230758955 -0.48724019 1.56744433 -0.2723291 0.59808708 -1.801314413
## 143 -0.034002444 -0.48724019 1.23072696 3.6647712 2.72964520 -1.254786331
## 144 0.056254596 -0.48724019 1.23072696 -0.2723291 2.72964520 -1.162275067
## 145 -0.096934161 -0.48724019 1.23072696 -0.2723291 2.72964520 -1.966411438
## 146 -0.143483937 -0.48724019 1.23072696 -0.2723291 2.72964520 -0.220083425
## 147 -0.169559485 -0.48724019 1.23072696 -0.2723291 2.72964520 -0.934555033
## 148 -0.144730225 -0.48724019 1.23072696 -0.2723291 2.72964520 -1.933676683
## 149 -0.149105020 -0.48724019 1.23072696 -0.2723291 2.72964520 -1.563631627
## 150 -0.102255298 -0.48724019 1.23072696 -0.2723291 2.72964520 -0.978675789
## 151 -0.227508376 -0.48724019 1.23072696 -0.2723291 2.72964520 -0.231469427
## 152 -0.246142237 -0.48724019 1.23072696 -0.2723291 2.72964520 -1.253363081
## 153 -0.289127538 -0.48724019 1.23072696 3.6647712 2.72964520 -1.811277165
## 154 -0.170241920 -0.48724019 1.23072696 -0.2723291 2.72964520 -0.819271765
## 155 -0.255730050 -0.48724019 1.23072696 3.6647712 2.72964520 -0.221506675
## 156 -0.009127843 -0.48724019 1.23072696 3.6647712 2.72964520 -0.188771920
## 157 -0.135655111 -0.48724019 1.23072696 -0.2723291 2.72964520 -1.441232109
## 158 -0.277850494 -0.48724019 1.23072696 -0.2723291 0.43412107 0.937018999
## 159 -0.263985543 -0.48724019 1.23072696 -0.2723291 0.43412107 -0.311171439
## 160 -0.254431446 -0.48724019 1.23072696 -0.2723291 2.72964520 0.320751657
## 161 -0.272051536 -0.48724019 1.23072696 3.6647712 0.43412107 -0.049293399
## 162 -0.249974107 -0.48724019 1.23072696 -0.2723291 0.43412107 1.714113616
## 163 -0.206910914 -0.48724019 1.23072696 3.6647712 0.43412107 2.159590934
## 164 -0.243503177 -0.48724019 1.23072696 3.6647712 0.43412107 2.975113306
## 165 -0.159408983 -0.48724019 1.23072696 -0.2723291 0.43412107 -0.612900484
## 166 -0.080162756 -0.48724019 1.23072696 -0.2723291 0.43412107 -0.261357681
## 167 -0.186400645 -0.48724019 1.23072696 -0.2723291 0.43412107 2.340343711
## 168 -0.210804400 -0.48724019 1.23072696 -0.2723291 0.43412107 -0.580165729
## 169 -0.152661358 -0.48724019 1.23072696 -0.2723291 0.43412107 0.048910866
## 170 -0.135323775 -0.48724019 1.23072696 -0.2723291 0.43412107 0.167040633
## 171 -0.279729226 -0.48724019 1.23072696 -0.2723291 0.43412107 -0.583012230
## 172 -0.151091873 -0.48724019 1.23072696 -0.2723291 0.43412107 -0.575895979
## 173 -0.403925517 -0.48724019 -1.03300497 -0.2723291 -0.38570897 -1.014257045
## 174 -0.409431505 -0.48724019 -1.03300497 -0.2723291 -0.38570897 0.186966136
## 175 -0.410281352 -0.48724019 -1.03300497 -0.2723291 -0.38570897 -0.605784233
## 176 -0.412354236 -0.48724019 -1.03300497 -0.2723291 -0.38570897 0.371988664
## 177 -0.411938031 -0.48724019 -1.03300497 -0.2723291 -0.38570897 -0.376640949
## 178 -0.413794675 -0.48724019 -1.03300497 -0.2723291 -0.38570897 0.043217865
## 179 -0.412379812 -0.48724019 -1.03300497 -0.2723291 -0.38570897 0.818889232
## 180 -0.413381958 -0.48724019 -1.26477147 -0.2723291 -0.57556435 0.989679257
## 181 -0.412442592 -0.48724019 -1.26477147 -0.2723291 -0.57556435 2.106930676
## 182 -0.412093817 -0.48724019 -1.26477147 -0.2723291 -0.57556435 -0.200157922
## 183 -0.409518699 -0.48724019 -1.26477147 -0.2723291 -0.57556435 1.238748045
## 184 -0.408466562 -0.48724019 -1.26477147 -0.2723291 -0.57556435 0.396183918
## 185 -0.410442951 -0.48724019 -1.26477147 -0.2723291 -0.57556435 -0.968713038
## 186 -0.413071549 -0.48724019 -1.26477147 -0.2723291 -0.57556435 -0.187348670
## 187 -0.413588898 -0.48724019 -1.26477147 -0.2723291 -0.57556435 2.200865190
## 188 -0.410946349 1.44223095 -1.12192167 -0.2723291 -1.01568364 0.707875715
## 189 -0.405477564 1.44223095 -1.12192167 -0.2723291 -1.01568364 0.386221166
## 190 -0.410370871 1.44223095 -1.12192167 -0.2723291 -1.01568364 1.281445551
## 191 -0.409559389 1.44223095 -1.12192167 -0.2723291 -1.01568364 0.948405001
## 192 -0.412067078 1.44223095 -1.12192167 -0.2723291 -1.01568364 0.646675956
## 193 -0.410029072 1.44223095 -1.12192167 -0.2723291 -1.01568364 1.271482800
## 194 -0.417559114 2.08538800 -1.19626187 -0.2723291 -1.32635608 0.733494219
## 195 -0.418428726 2.08538800 -1.19626187 -0.2723291 -1.32635608 0.454537177
## 196 -0.418496155 2.94293073 -1.55630166 -0.2723291 -1.14513049 2.263488199
## 197 -0.415438565 2.94293073 -1.40179066 -0.2723291 -1.30046671 1.426617073
## 198 -0.414677074 2.94293073 -1.40179066 -0.2723291 -1.30046671 1.170432035
## 199 -0.415721073 2.94293073 -1.40179066 -0.2723291 -1.30046671 1.408114820
## 200 -0.416439548 3.58608778 -1.40907891 -0.2723291 -1.30909650 0.982563006
## 201 -0.418034610 3.58608778 -1.40907891 -0.2723291 -1.30909650 1.210283041
## 202 -0.416096587 3.05012357 -1.32745046 -0.2723291 -1.20553902 -0.174539418
## 203 -0.417570740 3.05012357 -1.32745046 -0.2723291 -1.20553902 1.886326892
## 204 -0.416021019 3.58608778 -1.23270315 -0.2723291 -1.19604625 2.232176694
## 205 -0.417766054 3.58608778 -1.23270315 -0.2723291 -1.19604625 2.489784983
## 206 -0.404241740 -0.48724019 -0.07970124 -0.2723291 -0.56693456 -0.560240226
## 207 -0.393398339 -0.48724019 -0.07970124 -0.2723291 -0.56693456 0.058873617
## 208 -0.390805782 -0.48724019 -0.07970124 -0.2723291 -0.56693456 -0.713951249
## 209 -0.404305682 -0.48724019 -0.07970124 3.6647712 -0.56693456 -0.314017939
## 210 -0.369446828 -0.48724019 -0.07970124 3.6647712 -0.56693456 -1.338758093
## 211 -0.399819278 -0.48724019 -0.07970124 3.6647712 -0.56693456 -0.462035961
## 212 -0.376414181 -0.48724019 -0.07970124 3.6647712 -0.56693456 -1.253363081
## 213 -0.394851566 -0.48724019 -0.07970124 3.6647712 -0.56693456 -0.679793244
## 214 -0.403765081 -0.48724019 -0.07970124 -0.2723291 -0.56693456 0.128612878
## 215 -0.386439124 -0.48724019 -0.07970124 -0.2723291 -0.56693456 -1.241977079
## 216 -0.397080236 -0.48724019 -0.07970124 -0.2723291 -0.56693456 -0.146074414
## 217 -0.414800308 -0.48724019 0.40132357 3.6647712 -0.04051738 -0.564509977
## 218 -0.411948495 -0.48724019 0.40132357 -0.2723291 -0.04051738 0.508620685
## 219 -0.407233063 -0.48724019 0.40132357 3.6647712 -0.04051738 -0.474845213
## 220 -0.406819184 -0.48724019 0.40132357 3.6647712 -0.04051738 0.125766377
## 221 -0.378470788 -0.48724019 -0.71961001 3.6647712 -0.41159834 0.948405001
## 222 -0.372702057 -0.48724019 -0.71961001 3.6647712 -0.41159834 -0.171692918
## 223 -0.347607729 -0.48724019 -0.71961001 3.6647712 -0.41159834 0.845930986
## 224 -0.348637776 -0.48724019 -0.71961001 -0.2723291 -0.41159834 0.474462680
## 225 -0.383441988 -0.48724019 -0.71961001 -0.2723291 -0.43748771 2.819979033
## 226 -0.358841757 -0.48724019 -0.71961001 -0.2723291 -0.43748771 3.473250881
## 227 -0.375674779 -0.48724019 -0.71961001 -0.2723291 -0.43748771 2.498324485
## 228 -0.372159132 -0.48724019 -0.71961001 -0.2723291 -0.43748771 1.250134047
## 229 -0.385434654 -0.48724019 -0.71961001 -0.2723291 -0.43748771 1.994493909
## 230 -0.368741141 -0.48724019 -0.71961001 -0.2723291 -0.43748771 0.380528166
## 231 -0.357671037 -0.48724019 -0.71961001 -0.2723291 -0.43748771 -0.432147707
## 232 -0.366278793 -0.48724019 -0.71961001 -0.2723291 -0.43748771 1.604523350
## 233 -0.353219511 -0.48724019 -0.71961001 -0.2723291 -0.41159834 2.921029798
## 234 -0.381565581 -0.48724019 -0.71961001 -0.2723291 -0.41159834 2.792937279
## 235 -0.368028478 -0.48724019 -0.71961001 3.6647712 -0.41159834 0.628173703
## 236 -0.381684165 -0.48724019 -0.71961001 -0.2723291 -0.41159834 -0.282706434
## 237 -0.359579996 -0.48724019 -0.71961001 3.6647712 -0.41159834 0.492964932
## 238 -0.360597255 -0.48724019 -0.71961001 -0.2723291 -0.41159834 1.527667838
## 239 -0.410517356 0.79907391 -0.90473168 -0.2723291 -1.09335175 0.279477400
## 240 -0.409345474 0.79907391 -0.90473168 -0.2723291 -1.09335175 0.457383677
## 241 -0.406930791 0.79907391 -0.90473168 -0.2723291 -1.09335175 0.871549489
## 242 -0.407764363 0.79907391 -0.90473168 -0.2723291 -1.09335175 -0.269897182
## 243 -0.408138714 0.79907391 -0.90473168 -0.2723291 -1.09335175 0.104417624
## 244 -0.405270625 0.79907391 -0.90473168 -0.2723291 -1.09335175 0.154231381
## 245 -0.396143195 0.45605682 -0.76917014 -0.2723291 -1.06746238 -0.984368790
## 246 -0.397858003 0.45605682 -0.76917014 -0.2723291 -1.06746238 -0.967289788
## 247 -0.380593663 0.45605682 -0.76917014 -0.2723291 -1.06746238 -0.251394930
## 248 -0.397248810 0.45605682 -0.76917014 -0.2723291 -1.06746238 -0.083451404
## 249 -0.400989998 0.45605682 -0.76917014 -0.2723291 -1.06746238 0.211161390
## 250 -0.397927758 0.45605682 -0.76917014 -0.2723291 -1.06746238 0.616787701
## 251 -0.403790658 0.45605682 -0.76917014 -0.2723291 -1.06746238 0.288016902
## 252 -0.395211967 0.45605682 -0.76917014 -0.2723291 -1.06746238 0.218277641
## 253 -0.410544096 0.45605682 -0.76917014 -0.2723291 -1.06746238 0.956944502
## 254 -0.377209387 0.45605682 -0.76917014 -0.2723291 -1.06746238 2.810016281
## 255 -0.414499199 2.94293073 -1.09276866 -0.2723291 -1.40402419 -0.251394930
## 256 -0.415976841 2.94293073 -1.09276866 -0.2723291 -1.40402419 -0.581588979
## 257 -0.418313630 3.37170210 -1.07673449 -0.2723291 -1.38676461 1.664299859
## 258 -0.349005152 0.37030254 -1.04466617 -0.2723291 0.79657225 3.443362627
## 259 -0.342963214 0.37030254 -1.04466617 -0.2723291 0.79657225 1.492086583
## 260 -0.343760745 0.37030254 -1.04466617 -0.2723291 0.79657225 0.793270728
## 261 -0.357309474 0.37030254 -1.04466617 -0.2723291 0.79657225 1.307064055
## 262 -0.358005861 0.37030254 -1.04466617 -0.2723291 0.79657225 1.758234373
## 263 -0.359631150 0.37030254 -1.04466617 -0.2723291 0.79657225 3.007848061
## 264 -0.324158453 0.37030254 -1.04466617 -0.2723291 0.79657225 1.483547082
## 265 -0.356151543 0.37030254 -1.04466617 -0.2723291 0.79657225 1.311333806
## 266 -0.331557124 0.37030254 -1.04466617 -0.2723291 0.79657225 -1.031336047
## 267 -0.328757627 0.37030254 -1.04466617 -0.2723291 0.79657225 1.038069765
## 268 -0.352864924 0.37030254 -1.04466617 -0.2723291 0.17522737 2.864099790
## 269 -0.357264133 0.37030254 -1.04466617 -0.2723291 0.17522737 1.687071862
## 270 -0.409562877 0.37030254 -0.60882854 3.6647712 -0.78267931 -0.518965970
## 271 -0.385321883 0.37030254 -0.60882854 -0.2723291 -0.78267931 -0.610053984
## 272 -0.401255067 0.37030254 -0.60882854 -0.2723291 -0.78267931 -0.063525901
## 273 -0.406778493 0.37030254 -0.60882854 -0.2723291 -0.78267931 0.360602663
## 274 -0.394306315 0.37030254 -0.60882854 3.6647712 -0.78267931 2.001610160
## 275 -0.413540069 1.22784527 -0.68899934 3.6647712 -0.92938574 0.673717710
## 276 -0.408936245 1.22784527 -0.68899934 -0.2723291 -0.92938574 0.810349730
## 277 -0.407930612 1.22784527 -0.68899934 3.6647712 -0.92938574 1.398152069
## 278 -0.412978542 1.22784527 -0.68899934 3.6647712 -0.92938574 0.770498724
## 279 -0.410826603 1.22784527 -0.68899934 -0.2723291 -0.92938574 0.280900651
## 280 -0.395643285 0.37030254 -1.13795583 -0.2723291 -0.96476788 0.750573221
## 281 -0.415941963 0.37030254 -1.13795583 -0.2723291 -0.96476788 2.185209437
## 282 -0.415794315 0.37030254 -1.13795583 -0.2723291 -0.96476788 0.972600255
## 283 -0.412976217 0.37030254 -1.13795583 3.6647712 -0.96476788 1.936140650
## 284 -0.418356646 3.37170210 -1.44697784 3.6647712 -1.32635608 2.331804209
## 285 -0.419048382 3.37170210 -1.19043127 -0.2723291 -1.33498587 1.143390280
## 286 -0.418827491 1.87100232 -1.29538214 -0.2723291 -1.42991356 0.239626394
## 287 -0.417817208 2.94293073 -1.36680703 -0.2723291 -1.46443272 -0.077758404
## 288 -0.415601327 1.76380948 -0.84788329 -0.2723291 -1.29183692 -0.107646658
## 289 -0.414765430 1.76380948 -0.84788329 -0.2723291 -1.29183692 0.043217865
## 290 -0.415106067 1.76380948 -0.84788329 -0.2723291 -1.29183692 0.399030418
## 291 -0.416030319 2.94293073 -0.90181638 -0.2723291 -1.24005818 0.820312482
## 292 -0.410933561 2.94293073 -0.90181638 -0.2723291 -1.24005818 1.228785293
## 293 -0.415898948 2.94293073 -0.90181638 -0.2723291 -1.24005818 0.491541682
## 294 -0.410492942 -0.48724019 0.40569652 -0.2723291 -1.01568364 -0.224353176
## 295 -0.410569673 -0.48724019 0.40569652 -0.2723291 -1.01568364 -0.392296701
## 296 -0.405067173 -0.48724019 0.40569652 -0.2723291 -1.01568364 0.559857693
## 297 -0.413856291 -0.48724019 0.40569652 -0.2723291 -1.01568364 0.376258415
## 298 -0.403705789 -0.48724019 0.40569652 -0.2723291 -1.01568364 -0.703988498
## 299 -0.412584427 2.51415937 -1.29683979 -0.2723291 -1.33498587 0.085915371
## 300 -0.413636563 2.51415937 -1.29683979 -0.2723291 -1.33498587 1.076497520
## 301 -0.414966557 2.51415937 -1.29683979 -0.2723291 -1.33498587 0.834544984
## 302 -0.415989629 0.97058245 -0.73564417 -0.2723291 -1.05020280 0.434611674
## 303 -0.409329198 0.97058245 -0.73564417 -0.2723291 -1.05020280 0.299402903
## 304 -0.408475863 0.97058245 -0.73564417 -0.2723291 -1.05020280 0.992525758
## 305 -0.413690042 0.92770532 -1.30558569 -0.2723291 -0.71364099 1.354031312
## 306 -0.413731895 0.92770532 -1.30558569 -0.2723291 -0.71364099 0.471616179
## 307 -0.411378829 0.92770532 -1.30558569 -0.2723291 -0.71364099 1.615909352
## 308 -0.414367827 0.92770532 -1.30558569 -0.2723291 -0.71364099 0.803233479
## 309 -0.362788722 -0.48724019 -0.18027916 -0.2723291 -0.09229612 0.498657933
## 310 -0.379481072 -0.48724019 -0.18027916 -0.2723291 -0.09229612 -0.444956959
## 311 -0.113705566 -0.48724019 -0.18027916 -0.2723291 -0.09229612 -1.866783923
## 312 -0.328210051 -0.48724019 -0.18027916 -0.2723291 -0.09229612 -0.231469427
## 313 -0.389678077 -0.48724019 -0.18027916 -0.2723291 -0.09229612 -0.372371198
## 314 -0.388784052 -0.48724019 -0.18027916 -0.2723291 -0.09229612 -0.026521396
## 315 -0.377179160 -0.48724019 -0.18027916 -0.2723291 -0.09229612 0.401876919
## 316 -0.390623256 -0.48724019 -0.18027916 -0.2723291 -0.09229612 -0.824964766
## 317 -0.383100189 -0.48724019 -0.18027916 -0.2723291 -0.09229612 -0.527505471
## 318 -0.391592849 -0.48724019 -0.18027916 -0.2723291 -0.09229612 -0.715374500
## 319 -0.373363566 -0.48724019 -0.18027916 -0.2723291 -0.09229612 0.138575629
## 320 -0.364824403 -0.48724019 -0.18027916 -0.2723291 -0.09229612 -0.244278679
## 321 -0.400616810 -0.48724019 -0.54760720 -0.2723291 -0.53241540 0.201198639
## 322 -0.398990358 -0.48724019 -0.54760720 -0.2723291 -0.53241540 0.130036128
## 323 -0.379278783 -0.48724019 -0.54760720 -0.2723291 -0.53241540 -0.346752694
## 324 -0.387093658 -0.48724019 -0.54760720 -0.2723291 -0.53241540 -0.820695015
## 325 -0.380447177 -0.48724019 -0.54760720 -0.2723291 -0.53241540 0.185542886
## 326 -0.397796386 -0.48724019 -0.54760720 -0.2723291 -0.53241540 0.208314890
## 327 -0.384820810 -0.48724019 -0.54760720 -0.2723291 -0.53241540 0.038948114
## 328 -0.392079971 -0.48724019 -0.54760720 -0.2723291 -0.53241540 -0.286976185
## 329 -0.412408877 -0.48724019 -1.15107469 -0.2723291 -0.81719847 -0.592974981
## 330 -0.412284481 -0.48724019 -1.15107469 -0.2723291 -0.81719847 0.068836369
## 331 -0.414818909 -0.48724019 -1.15107469 -0.2723291 -0.81719847 -0.200157922
## 332 -0.414262032 1.01345959 -0.74001712 -0.2723291 -1.00791683 -0.823541516
## 333 -0.416072172 1.01345959 -0.74001712 -0.2723291 -1.00791683 -0.360985196
## 334 -0.414192278 -0.48724019 -0.86683276 -0.2723291 -0.34256002 0.044641115
## 335 -0.415755950 -0.48724019 -0.86683276 -0.2723291 -0.34256002 0.036101614
## 336 -0.415496694 -0.48724019 -0.86683276 -0.2723291 -0.34256002 -0.352445695
## 337 -0.416117513 -0.48724019 -0.86683276 -0.2723291 -0.34256002 -0.591551731
## 338 -0.416566270 -0.48724019 -0.86683276 -0.2723291 -0.34256002 -0.554547225
## 339 -0.416258185 -0.48724019 -0.86683276 -0.2723291 -0.34256002 -0.321134190
## 340 -0.413710969 -0.48724019 -0.86683276 -0.2723291 -0.34256002 -0.426454706
## 341 -0.412950640 -0.48724019 -0.86683276 -0.2723291 -0.34256002 -0.450649960
## 342 -0.418589162 1.01345959 -1.40179066 -0.2723291 -0.97253469 1.361147563
## 343 -0.417197552 -0.48724019 -1.34785757 -0.2723291 -0.31667065 0.363449163
## 344 -0.417145235 1.87100232 -1.07236154 -0.2723291 -0.61008351 0.585476196
## 345 -0.416556969 1.87100232 -1.07236154 -0.2723291 -0.61008351 0.838814735
## 346 -0.416482564 -0.48724019 -0.98344483 -0.2723291 -0.97253469 -0.385180450
## 347 -0.412937852 -0.48724019 -0.98344483 -0.2723291 -0.97253469 -0.550277475
## 348 -0.417927653 3.15731641 -1.01842846 -0.2723291 -1.08472196 0.329291158
## 349 -0.418356646 2.94293073 -1.33036576 -0.2723291 -1.03294322 0.498657933
## 350 -0.416731356 1.22784527 -1.44114723 -0.2723291 -1.08472196 0.931325998
## 351 -0.412880885 1.22784527 -1.44114723 -0.2723291 -1.08472196 0.292286652
## 352 -0.410859155 2.08538800 -1.37701059 -0.2723291 -1.24005818 0.418955921
## 353 -0.411679938 2.08538800 -1.37701059 -0.2723291 -1.24005818 -0.570202978
## 354 -0.418114829 3.37170210 -1.32890811 -0.2723291 -1.24868797 0.631020203
## 355 -0.415101417 2.94293073 -1.34494227 -0.2723291 -1.22279860 -0.884741275
## 356 -0.407709721 2.94293073 -1.34494227 -0.2723291 -1.22279860 -0.496193967
## 357 0.624240921 -0.48724019 1.01499462 3.6647712 1.85803641 -0.103376907
## 358 0.027457444 -0.48724019 1.01499462 3.6647712 1.85803641 0.157077882
## 359 0.184646645 -0.48724019 1.01499462 3.6647712 1.85803641 -0.224353176
## 360 0.075310474 -0.48724019 1.01499462 -0.2723291 1.85803641 -0.245701929
## 361 0.107933683 -0.48724019 1.01499462 -0.2723291 1.85803641 0.161347633
## 362 0.025962364 -0.48724019 1.01499462 -0.2723291 1.85803641 -0.047870149
## 363 0.007521491 -0.48724019 1.01499462 -0.2723291 1.85803641 -1.313139590
## 364 0.070785706 -0.48724019 1.01499462 3.6647712 1.85803641 -0.685486245
## 365 -0.016188203 -0.48724019 1.01499462 3.6647712 1.40928733 3.551529643
## 366 0.109555485 -0.48724019 1.01499462 -0.2723291 1.40928733 -3.876413226
## 367 0.009699007 -0.48724019 1.01499462 -0.2723291 1.40928733 -1.881016425
## 368 1.151964713 -0.48724019 1.01499462 -0.2723291 0.65849561 -3.446591661
## 369 0.149356473 -0.48724019 1.01499462 -0.2723291 0.65849561 -1.871053674
## 370 0.239079888 -0.48724019 1.01499462 3.6647712 0.65849561 0.566973944
## 371 0.340082672 -0.48724019 1.01499462 3.6647712 0.65849561 1.040916265
## 372 0.653228737 -0.48724019 1.01499462 -0.2723291 0.65849561 -0.097683907
## 373 0.541033778 -0.48724019 1.01499462 3.6647712 0.97779784 -0.583012230
## 374 0.871305835 -0.48724019 1.01499462 -0.2723291 0.97779784 -1.962141687
## 375 1.730465429 -0.48724019 1.01499462 -0.2723291 0.97779784 -3.055197852
## 376 1.859616644 -0.48724019 1.01499462 -0.2723291 1.00368721 1.463621579
## 377 1.357253412 -0.48724019 1.01499462 -0.2723291 1.00368721 0.518583436
## 378 0.721959412 -0.48724019 1.01499462 -0.2723291 1.00368721 0.724954717
## 379 2.329195069 -0.48724019 1.01499462 -0.2723291 1.00368721 0.135729129
## 380 1.657048387 -0.48724019 1.01499462 -0.2723291 1.00368721 -0.087721155
## 381 9.924109610 -0.48724019 1.01499462 -0.2723291 1.00368721 0.972600255
## 382 1.425427210 -0.48724019 1.01499462 -0.2723291 1.00368721 0.370565414
## 383 0.647964566 -0.48724019 1.01499462 -0.2723291 1.25395112 -1.065494052
## 384 0.509089517 -0.48724019 1.01499462 -0.2723291 1.25395112 -1.088266056
## 385 1.914932287 -0.48724019 1.01499462 -0.2723291 1.25395112 -2.727850303
## 386 1.534407630 -0.48724019 1.01499462 -0.2723291 1.25395112 -1.434115858
## 387 2.415877170 -0.48724019 1.01499462 -0.2723291 1.25395112 -2.323647242
## 388 2.206996093 -0.48724019 1.01499462 -0.2723291 1.25395112 -1.828356167
## 389 1.246308229 -0.48724019 1.01499462 -0.2723291 1.25395112 -1.999146193
## 390 0.527604795 -0.48724019 1.01499462 -0.2723291 1.25395112 -1.273288584
## 391 0.389305224 -0.48724019 1.01499462 -0.2723291 1.25395112 -0.813578764
## 392 0.195258692 -0.48724019 1.01499462 -0.2723291 1.25395112 -0.332520192
## 393 0.925923929 -0.48724019 1.01499462 -0.2723291 1.25395112 -1.777119159
## 394 0.584922404 -0.48724019 1.01499462 -0.2723291 1.19354259 -0.130418661
## 395 1.133084385 -0.48724019 1.01499462 -0.2723291 1.19354259 -0.565933227
## 396 0.593291831 -0.48724019 1.01499462 -0.2723291 1.19354259 0.265244898
## 397 0.262572179 -0.48724019 1.01499462 -0.2723291 1.19354259 0.171310384
## 398 0.471833420 -0.48724019 1.01499462 -0.2723291 1.19354259 -0.765188257
## 399 4.038608880 -0.48724019 1.01499462 -0.2723291 1.19354259 -1.183623820
## 400 0.732778398 -0.48724019 1.01499462 -0.2723291 1.19354259 -0.615746985
## 401 2.491712382 -0.48724019 1.01499462 -0.2723291 1.19354259 -0.423608206
## 402 1.234973056 -0.48724019 1.01499462 -0.2723291 1.19354259 0.083068871
## 403 0.695478123 -0.48724019 1.01499462 -0.2723291 1.19354259 0.169887134
## 404 2.463298882 -0.48724019 1.01499462 -0.2723291 1.19354259 -1.331641842
## 405 4.408007629 -0.48724019 1.01499462 -0.2723291 1.19354259 -1.072610303
## 406 7.476247076 -0.48724019 1.01499462 -0.2723291 1.19354259 -0.856276271
## 407 1.988326078 -0.48724019 1.01499462 -0.2723291 0.90012973 -3.055197852
## 408 0.969311483 -0.48724019 1.01499462 -0.2723291 0.90012973 -0.963020037
## 409 0.440661113 -0.48724019 1.01499462 -0.2723291 0.36508275 -0.950210785
## 410 1.258468834 -0.48724019 1.01499462 -0.2723291 0.36508275 0.807503230
## 411 5.524853484 -0.48724019 1.01499462 -0.2723291 0.36508275 -0.750955755
## 412 1.213407163 -0.48724019 1.01499462 -0.2723291 0.36508275 0.529969438
## 413 1.766830989 -0.48724019 1.01499462 -0.2723291 0.36508275 -2.357805247
## 414 2.911369543 -0.48724019 1.01499462 -0.2723291 0.36508275 -1.607752384
## 415 4.898256758 -0.48724019 1.01499462 -0.2723291 1.19354259 -2.512939520
## 416 1.682381045 -0.48724019 1.01499462 -0.2723291 1.07272553 0.212584640
## 417 0.839462719 -0.48724019 1.01499462 -0.2723291 1.07272553 0.707875715
## 418 2.595705326 -0.48724019 1.01499462 -0.2723291 1.07272553 -1.395688102
## 419 8.128839131 -0.48724019 1.01499462 -0.2723291 1.07272553 -0.466305712
## 420 0.953174847 -0.48724019 1.01499462 -0.2723291 1.40928733 0.767652224
## 421 0.868899291 -0.48724019 1.01499462 -0.2723291 1.40928733 0.179849885
## 422 0.396331868 -0.48724019 1.01499462 -0.2723291 1.40928733 -0.396566452
## 423 0.980600153 -0.48724019 1.01499462 -0.2723291 0.51178918 -0.906090028
## 424 0.399567334 -0.48724019 1.01499462 -0.2723291 0.51178918 -0.258511181
## 425 0.602054210 -0.48724019 1.01499462 -0.2723291 0.25289548 -1.024219796
## 426 1.423787970 -0.48724019 1.01499462 -0.2723291 1.07272553 -0.553123975
## 427 1.003735531 -0.48724019 1.01499462 -0.2723291 0.25289548 -0.637095738
## 428 3.958402360 -0.48724019 1.01499462 -0.2723291 1.07272553 -0.117609410
## 429 0.436385137 -0.48724019 1.01499462 -0.2723291 1.07272553 -0.130418661
## 430 0.665620696 -0.48724019 1.01499462 -0.2723291 1.07272553 0.135729129
## 431 0.567177918 -0.48724019 1.01499462 -0.2723291 0.25289548 0.090185122
## 432 0.749723028 -0.48724019 1.01499462 -0.2723291 0.25289548 0.780461476
## 433 0.329071860 -0.48724019 1.01499462 -0.2723291 0.25289548 0.199775388
## 434 0.228743373 -0.48724019 1.01499462 -0.2723291 1.36613839 0.215431141
## 435 1.197444914 -0.48724019 1.01499462 -0.2723291 1.36613839 -0.109069908
## 436 0.877386138 -0.48724019 1.01499462 -0.2723291 1.59914271 0.490118432
## 437 1.256434316 -0.48724019 1.01499462 -0.2723291 1.59914271 0.251012396
## 438 1.344372005 -0.48724019 1.01499462 -0.2723291 1.59914271 -0.188771920
## 439 1.170089364 -0.48724019 1.01499462 -0.2723291 1.59914271 -0.497617217
## 440 0.671635895 -0.48724019 1.01499462 -0.2723291 1.59914271 -0.935978283
## 441 2.143519126 -0.48724019 1.01499462 -0.2723291 1.59914271 -0.664137492
## 442 0.710413811 -0.48724019 1.01499462 -0.2723291 1.59914271 0.172733634
## 443 0.238660196 -0.48724019 1.01499462 -0.2723291 1.59914271 -0.093414156
## 444 0.738590145 -0.48724019 1.01499462 -0.2723291 1.59914271 0.285170401
## 445 1.068270448 -0.48724019 1.01499462 -0.2723291 1.59914271 -0.612900484
## 446 0.820582390 -0.48724019 1.01499462 -0.2723291 1.59914271 0.248165896
## 447 0.310937908 -0.48724019 1.01499462 -0.2723291 1.59914271 0.080222370
## 448 0.733743341 -0.48724019 1.01499462 -0.2723291 1.59914271 -0.047870149
## 449 0.664481366 -0.48724019 1.01499462 -0.2723291 1.36613839 -0.141804663
## 450 0.454858563 -0.48724019 1.01499462 -0.2723291 1.36613839 0.188389387
## 451 0.360888236 -0.48724019 1.01499462 -0.2723291 1.36613839 0.660908458
## 452 0.212475366 -0.48724019 1.01499462 -0.2723291 1.36613839 0.527122938
## 453 0.171672232 -0.48724019 1.01499462 -0.2723291 1.36613839 0.017599361
## 454 0.538806271 -0.48724019 1.01499462 -0.2723291 1.36613839 1.577481596
## 455 0.685935651 -0.48724019 1.01499462 -0.2723291 1.36613839 0.631020203
## 456 0.132400217 -0.48724019 1.01499462 -0.2723291 1.36613839 0.342100410
## 457 0.122688009 -0.48724019 1.01499462 -0.2723291 1.36613839 -0.439263958
## 458 0.533282845 -0.48724019 1.01499462 -0.2723291 1.36613839 -0.496193967
## 459 0.481158489 -0.48724019 1.01499462 -0.2723291 1.36613839 0.023292362
## 460 0.370589982 -0.48724019 1.01499462 -0.2723291 1.36613839 -0.289822685
## 461 0.139347806 -0.48724019 1.01499462 -0.2723291 1.36613839 0.592592447
## 462 0.009252575 -0.48724019 1.01499462 -0.2723291 1.36613839 0.130036128
## 463 0.353587222 -0.48724019 1.01499462 -0.2723291 1.36613839 0.046064365
## 464 0.256654638 -0.48724019 1.01499462 -0.2723291 1.36613839 0.325021407
## 465 0.491283414 -0.48724019 1.01499462 -0.2723291 0.86561057 -0.107646658
## 466 -0.052307295 -0.48724019 1.01499462 -0.2723291 0.86561057 -0.748109254
## 467 0.018770633 -0.48724019 1.01499462 -0.2723291 0.86561057 -0.473421963
## 468 0.094024554 -0.48724019 1.01499462 -0.2723291 0.25289548 -0.400836202
## 469 1.390700891 -0.48724019 1.01499462 -0.2723291 0.21837632 -0.510426469
## 470 1.099985680 -0.48724019 1.01499462 -0.2723291 0.21837632 -0.813578764
## 471 0.085480740 -0.48724019 1.01499462 -0.2723291 0.21837632 -0.167423167
## 472 0.049396526 -0.48724019 1.01499462 -0.2723291 -0.19585359 -0.079181654
## 473 -0.005213430 -0.48724019 1.01499462 -0.2723291 0.21837632 0.216854391
## 474 0.120137304 -0.48724019 1.01499462 -0.2723291 0.51178918 0.989679257
## 475 0.516449822 -0.48724019 1.01499462 -0.2723291 0.25289548 -1.220628326
## 476 0.323150830 -0.48724019 1.01499462 -0.2723291 0.25289548 -0.174539418
## 477 0.146239592 -0.48724019 1.01499462 -0.2723291 0.51178918 0.283747151
## 478 1.326491497 -0.48724019 1.01499462 -0.2723291 0.51178918 -1.395688102
## 479 0.769568300 -0.48724019 1.01499462 -0.2723291 0.51178918 -0.141804663
## 480 1.246308229 -0.48724019 1.01499462 -0.2723291 0.51178918 -0.079181654
## 481 0.256987136 -0.48724019 1.01499462 -0.2723291 -0.19585359 -0.060679401
## 482 0.243520951 -0.48724019 1.01499462 -0.2723291 -0.19585359 0.662331708
## 483 0.246192564 -0.48724019 1.01499462 -0.2723291 -0.19585359 1.104962525
## 484 -0.092441945 -0.48724019 1.01499462 -0.2723291 -0.19585359 -0.743839504
## 485 -0.143573456 -0.48724019 1.01499462 -0.2723291 0.24426569 -0.588705230
## 486 0.006992516 -0.48724019 1.01499462 -0.2723291 0.24426569 0.038948114
## 487 0.241610829 -0.48724019 1.01499462 -0.2723291 0.24426569 -0.242855428
## 488 0.142084524 -0.48724019 1.01499462 -0.2723291 0.24426569 -0.540314723
## 489 -0.402562972 -0.48724019 2.42017014 -0.2723291 0.46864023 -1.182200570
## 490 -0.398783418 -0.48724019 2.42017014 -0.2723291 0.46864023 -1.239130578
## 491 -0.395982758 -0.48724019 2.42017014 -0.2723291 0.46864023 -1.695993897
## 492 -0.407808541 -0.48724019 2.42017014 -0.2723291 0.46864023 -0.429301206
## 493 -0.407159820 -0.48724019 2.42017014 -0.2723291 0.46864023 -0.429301206
## 494 -0.399952975 -0.48724019 -0.21088983 -0.2723291 0.26152527 -0.822118266
## 495 -0.387599381 -0.48724019 -0.21088983 -0.2723291 0.26152527 -0.510426469
## 496 -0.399292629 -0.48724019 -0.21088983 -0.2723291 0.26152527 -0.874778524
## 497 -0.386433311 -0.48724019 -0.21088983 -0.2723291 0.26152527 -1.273288584
## 498 -0.388900310 -0.48724019 -0.21088983 -0.2723291 0.26152527 -0.698295497
## 499 -0.392302024 -0.48724019 -0.21088983 -0.2723291 0.26152527 -0.378064199
## 500 -0.399427488 -0.48724019 -0.21088983 -0.2723291 0.26152527 -1.018526795
## 501 -0.394015670 -0.48724019 -0.21088983 -0.2723291 0.26152527 -0.366678197
## 502 -0.412820431 -0.48724019 0.11562398 -0.2723291 0.15796779 0.438881424
## 503 -0.414838673 -0.48724019 0.11562398 -0.2723291 0.15796779 -0.234315927
## 504 -0.413037834 -0.48724019 0.11562398 -0.2723291 0.15796779 0.983986256
## 505 -0.407360947 -0.48724019 0.11562398 -0.2723291 0.15796779 0.724954717
## 506 -0.414589880 -0.48724019 0.11562398 -0.2723291 0.15796779 -0.362408446
## age dis rad tax ptratio black
## 1 -0.119894767 0.1400749840 -0.9818712 -0.66594918 -1.45755797 0.440615895
## 2 0.366803426 0.5566090496 -0.8670245 -0.98635338 -0.30279450 0.440615895
## 3 -0.265548971 0.5566090496 -0.8670245 -0.98635338 -0.30279450 0.396035074
## 4 -0.809087830 1.0766711351 -0.7521778 -1.10502160 0.11292035 0.415751408
## 5 -0.510674339 1.0766711351 -0.7521778 -1.10502160 0.11292035 0.440615895
## 6 -0.350809969 1.0766711351 -0.7521778 -1.10502160 0.11292035 0.410165113
## 7 -0.070159185 0.8384142195 -0.5224844 -0.57694801 -1.50374851 0.426376321
## 8 0.977840575 1.0236248974 -0.5224844 -0.57694801 -1.50374851 0.440615895
## 9 1.116389695 1.0861216287 -0.5224844 -0.57694801 -1.50374851 0.328123258
## 10 0.615481336 1.3283202075 -0.5224844 -0.57694801 -1.50374851 0.328999540
## 11 0.913894827 1.2117799501 -0.5224844 -0.57694801 -1.50374851 0.392639483
## 12 0.508905089 1.1547920492 -0.5224844 -0.57694801 -1.50374851 0.440615895
## 13 -1.050660656 0.7863652700 -0.5224844 -0.57694801 -1.50374851 0.370513376
## 14 -0.240681180 0.4333252240 -0.6373311 -0.60068166 1.17530274 0.440615895
## 15 0.565745754 0.3166899868 -0.6373311 -0.60068166 1.17530274 0.255720500
## 16 -0.428965883 0.3341187865 -0.6373311 -0.60068166 1.17530274 0.426595391
## 17 -1.395257187 0.3341187865 -0.6373311 -0.60068166 1.17530274 0.330533033
## 18 0.466274590 0.2198105553 -0.6373311 -0.60068166 1.17530274 0.329437681
## 19 -1.135921653 0.0006920764 -0.6373311 -0.60068166 1.17530274 -0.741378303
## 20 0.032864520 0.0006920764 -0.6373311 -0.60068166 1.17530274 0.375442459
## 21 1.048891406 0.0013569352 -0.6373311 -0.60068166 1.17530274 0.217930861
## 22 0.732715207 0.1031753182 -0.6373311 -0.60068166 1.17530274 0.392749018
## 23 0.821528746 0.0863638874 -0.6373311 -0.60068166 1.17530274 0.440615895
## 24 1.116389695 0.1425444597 -0.6373311 -0.60068166 1.17530274 0.414765591
## 25 0.906789743 0.2871037683 -0.6373311 -0.60068166 1.17530274 0.412465352
## 26 0.608376252 0.3132232229 -0.6373311 -0.60068166 1.17530274 -0.583319029
## 27 0.771793164 0.4212152950 -0.6373311 -0.60068166 1.17530274 0.221326452
## 28 0.718505041 0.3126533438 -0.6373311 -0.60068166 1.17530274 -0.550896614
## 29 0.917447368 0.3132707128 -0.6373311 -0.60068166 1.17530274 0.342472368
## 30 0.665216917 0.2108349609 -0.6373311 -0.60068166 1.17530274 0.258020739
## 31 0.906789743 0.2079855659 -0.6373311 -0.60068166 1.17530274 0.038293155
## 32 1.116389695 0.1804414138 -0.6373311 -0.60068166 1.17530274 0.219683424
## 33 0.476932215 0.0925850666 -0.6373311 -0.60068166 1.17530274 -1.359047220
## 34 0.938762618 -0.0037244859 -0.6373311 -0.60068166 1.17530274 0.022958229
## 35 1.006260907 -0.0167367233 -0.6373311 -0.60068166 1.17530274 -1.186967442
## 36 -0.013318520 -0.2064589434 -0.5224844 -0.76681717 0.34387304 0.440615895
## 37 -0.254891346 -0.1981007179 -0.5224844 -0.76681717 0.34387304 0.228774844
## 38 -0.961847117 0.0660856927 -0.5224844 -0.76681717 0.34387304 0.440615895
## 39 -1.363284313 0.0248169544 -0.5224844 -0.76681717 0.34387304 0.402607185
## 40 -1.661697804 0.7627152911 -0.7521778 -0.92701927 -0.07184181 0.426704926
## 41 -1.874850298 0.7627152911 -0.7521778 -0.92701927 -0.07184181 0.426595391
## 42 -2.333128159 0.9145880470 -0.7521778 -1.03975408 -0.25660396 0.314759966
## 43 -2.201684121 0.9145880470 -0.7521778 -1.03975408 -0.25660396 0.292414788
## 44 -2.205236663 0.9145880470 -0.7521778 -1.03975408 -0.25660396 0.413889309
## 45 -1.015135240 0.9145880470 -0.7521778 -1.03975408 -0.25660396 0.358354970
## 46 -1.235392817 0.6199131095 -0.7521778 -1.03975408 -0.25660396 0.440615895
## 47 -1.253155525 0.6199131095 -0.7521778 -1.03975408 -0.25660396 0.440615895
## 48 0.601271169 0.8996287230 -0.7521778 -1.03975408 -0.25660396 0.395049257
## 49 0.949420242 0.9853955139 -0.7521778 -1.03975408 -0.25660396 0.440615895
## 50 -0.233576097 1.0887810641 -0.7521778 -1.03975408 -0.25660396 0.440615895
## 51 -0.812640371 1.4340327636 -0.6373311 -0.98041997 -0.76469989 0.425938180
## 52 -0.198050682 1.4340327636 -0.6373311 -0.98041997 -0.76469989 0.408522085
## 53 -1.686565595 1.4340327636 -0.6373311 -0.98041997 -0.76469989 0.440615895
## 54 -1.675907970 1.4340327636 -0.6373311 -0.98041997 -0.76469989 0.440615895
## 55 -0.745142082 1.6738568465 -0.7521778 0.36053095 1.22149328 0.440615895
## 56 -1.658145262 2.3277455193 -0.5224844 -1.08128796 -0.25660396 0.429990982
## 57 -1.167894527 2.5609210138 -0.8670245 -0.56508119 -0.53374719 0.440615895
## 58 -0.997372532 2.1511780064 -0.5224844 -0.90328562 -1.54993904 0.396801820
## 59 -1.398809729 1.9089794276 -0.1779443 -0.73715011 0.57482574 0.372485009
## 60 -0.759352248 1.4897384367 -0.1779443 -0.73715011 0.57482574 0.440615895
## 61 -0.084369352 1.6290738544 -0.1779443 -0.73715011 0.57482574 0.421009097
## 62 0.881921953 1.4358373805 -0.1779443 -0.73715011 0.57482574 0.234470674
## 63 -0.027528687 1.6291213443 -0.1779443 -0.73715011 0.57482574 0.440615895
## 64 -0.894348827 1.9878601804 -0.1779443 -0.73715011 0.57482574 0.426157250
## 65 -0.322389636 2.5776849546 -0.7521778 -1.14062207 0.06672981 0.400526017
## 66 -1.803799466 1.3375332514 -0.6373311 -0.42267932 -1.08803366 0.440615895
## 67 -1.331311439 1.3375332514 -0.6373311 -0.42267932 -1.08803366 0.440615895
## 68 -1.675907970 1.2836321952 -0.6373311 -0.37521203 0.20530143 0.433057967
## 69 -1.128816570 1.2836321952 -0.6373311 -0.37521203 0.20530143 0.440615895
## 70 -1.263813149 1.2836321952 -0.6373311 -0.37521203 0.20530143 0.440615895
## 71 -2.201684121 0.7086717651 -0.6373311 -0.61254848 0.34387304 0.296358054
## 72 -1.814457091 0.7086717651 -0.6373311 -0.61254848 0.34387304 0.221983663
## 73 -2.159053622 0.7086717651 -0.6373311 -0.61254848 0.34387304 0.375004318
## 74 -2.215894287 0.7086717651 -0.6373311 -0.61254848 0.34387304 0.224502972
## 75 -2.222999370 0.2167712006 -0.5224844 -0.06074124 0.11292035 0.418927928
## 76 -0.837508162 0.3360183832 -0.5224844 -0.06074124 0.11292035 0.290881295
## 77 0.210491598 0.1221237952 -0.5224844 -0.06074124 0.11292035 0.186056121
## 78 -0.809087830 0.1403124336 -0.5224844 -0.06074124 0.11292035 0.331737920
## 79 -0.528437047 0.5789293108 -0.5224844 -0.06074124 0.11292035 0.325603949
## 80 -1.135921653 0.3360183832 -0.5224844 -0.06074124 0.11292035 0.431414939
## 81 -1.246050442 0.7625253315 -0.6373311 -0.75495035 0.25149196 0.440615895
## 82 0.064837394 0.7625253315 -0.6373311 -0.75495035 0.25149196 0.426704926
## 83 -1.292233482 0.7625253315 -0.6373311 -0.75495035 0.25149196 0.440615895
## 84 -0.777114956 0.7625253315 -0.6373311 -0.75495035 0.25149196 0.372046868
## 85 -0.730931915 0.4674704746 -0.7521778 -0.95668632 0.02053927 0.440615895
## 86 -0.443176049 0.3051974268 -0.7521778 -0.95668632 0.02053927 0.390229709
## 87 -0.833955621 0.3002109855 -0.7521778 -0.95668632 0.02053927 0.430648193
## 88 -0.418308258 -0.0225304932 -0.7521778 -0.95668632 0.02053927 0.421447237
## 89 0.629691502 -0.1773001341 -0.8670245 -0.82021787 -0.30279450 0.440615895
## 90 -0.194498140 -0.1807194081 -0.8670245 -0.82021787 -0.30279450 0.431414939
## 91 -0.087921893 -0.3337319220 -0.8670245 -0.82021787 -0.30279450 0.388915287
## 92 0.189176348 -0.3338269018 -0.8670245 -0.82021787 -0.30279450 0.403921608
## 93 -0.531989588 -0.0613297558 -0.6373311 -0.82021787 -0.11803234 0.419913745
## 94 -1.409467353 -0.0613297558 -0.6373311 -0.82021787 -0.11803234 0.434372389
## 95 0.309962761 -0.0855021237 -0.6373311 -0.82021787 -0.11803234 0.440615895
## 96 -0.382782843 -0.1423950448 -0.8670245 -0.78461740 -0.21041342 0.014304949
## 97 0.036417061 -0.1423950448 -0.8670245 -0.78461740 -0.21041342 0.385081555
## 98 0.263779721 -0.1423950448 -0.8670245 -0.78461740 -0.21041342 0.440615895
## 99 -1.125264029 -0.1423950448 -0.8670245 -0.78461740 -0.21041342 0.403702537
## 100 -0.215813389 -0.1423950448 -0.8670245 -0.78461740 -0.21041342 0.440615895
## 101 0.402328842 -0.4830877123 -0.5224844 -0.14380900 1.12911220 0.417175365
## 102 0.096810268 -0.4459031069 -0.5224844 -0.14380900 1.12911220 0.426157250
## 103 0.597718628 -0.5130538501 -0.5224844 -0.14380900 1.12911220 -3.131326538
## 104 0.668769459 -0.5130538501 -0.5224844 -0.14380900 1.12911220 0.413998845
## 105 0.761135540 -0.6525317376 -0.5224844 -0.14380900 1.12911220 0.394501581
## 106 0.999155824 -0.8016975682 -0.5224844 -0.14380900 1.12911220 0.409398367
## 107 0.828633829 -0.7522605641 -0.5224844 -0.14380900 1.12911220 0.427143067
## 108 0.590613545 -0.7943366310 -0.5224844 -0.14380900 1.12911220 0.339733988
## 109 1.013365990 -0.6468804374 -0.5224844 -0.14380900 1.12911220 0.422433054
## 110 0.803766038 -0.5935967501 -0.5224844 -0.14380900 1.12911220 0.378509444
## 111 -0.503569256 -0.4830877123 -0.5224844 -0.14380900 1.12911220 0.403264396
## 112 0.462722049 -0.5307200994 -0.4076377 0.14099473 -0.30279450 0.426266786
## 113 0.864159245 -0.6846349217 -0.4076377 0.14099473 -0.30279450 0.419256534
## 114 0.952972784 -0.5922195425 -0.4076377 0.14099473 -0.30279450 0.440615895
## 115 0.555088129 -0.7306526517 -0.4076377 0.14099473 -0.30279450 0.351235183
## 116 0.697189791 -0.6325384823 -0.4076377 0.14099473 -0.30279450 -0.128857540
## 117 0.139440767 -0.5057404029 -0.4076377 0.14099473 -0.30279450 0.401183228
## 118 0.498247464 -0.4975246471 -0.4076377 0.14099473 -0.30279450 0.414436985
## 119 0.160756016 -0.6256999342 -0.4076377 0.14099473 -0.30279450 -0.197645637
## 120 -0.119894767 -0.4919208369 -0.4076377 0.14099473 -0.30279450 0.381466894
## 121 0.039969603 -0.7300827727 -0.8670245 -1.30675758 0.29768250 0.355726125
## 122 0.551535588 -0.7587191929 -0.8670245 -1.30675758 0.29768250 0.229979731
## 123 0.864159245 -0.8111955516 -0.8670245 -1.30675758 0.29768250 0.234580209
## 124 1.009813449 -0.8788686839 -0.8670245 -1.30675758 0.29768250 0.149361834
## 125 0.967182950 -0.8494724251 -0.8670245 -1.30675758 0.29768250 0.248710248
## 126 0.704294875 -0.8558360740 -0.8670245 -1.30675758 0.29768250 0.310488093
## 127 0.960077867 -0.9677698093 -0.8670245 -1.30675758 0.29768250 0.028654058
## 128 0.974288033 -0.9530004450 -0.6373311 0.17066179 1.26768382 0.388148541
## 129 1.073759197 -0.9415078850 -0.6373311 0.17066179 1.26768382 0.440615895
## 130 0.928104993 -0.8620097633 -0.6373311 0.17066179 1.26768382 0.440615895
## 131 1.077311738 -0.7961887377 -0.6373311 0.17066179 1.26768382 0.420242350
## 132 1.034681240 -0.7237666137 -0.6373311 0.17066179 1.26768382 0.440615895
## 133 1.041786323 -0.6969823003 -0.6373311 0.17066179 1.26768382 0.318593697
## 134 0.952972784 -0.6293091680 -0.6373311 0.17066179 1.26768382 0.350687507
## 135 1.059549031 -0.6881491756 -0.6373311 0.17066179 1.26768382 -1.028689097
## 136 1.052443947 -0.7998929513 -0.6373311 0.17066179 1.26768382 0.416189548
## 137 0.885474494 -0.8681834525 -0.6373311 0.17066179 1.26768382 0.236332772
## 138 1.059549031 -0.9237941458 -0.6373311 0.17066179 1.26768382 0.409726972
## 139 1.052443947 -1.0098458762 -0.6373311 0.17066179 1.26768382 0.387381794
## 140 1.041786323 -1.0097983862 -0.6373311 0.17066179 1.26768382 0.440615895
## 141 0.889027036 -1.0367726593 -0.6373311 0.17066179 1.26768382 0.344005860
## 142 1.116389695 -1.1186927669 -0.6373311 0.17066179 1.26768382 0.440615895
## 143 1.116389695 -1.1746358896 -0.5224844 -0.03107419 -1.73470120 0.440615895
## 144 1.116389695 -1.1317999841 -0.5224844 -0.03107419 -1.73470120 0.440615895
## 145 1.038233781 -1.1630958396 -0.5224844 -0.03107419 -1.73470120 0.440615895
## 146 1.116389695 -1.1283332201 -0.5224844 -0.03107419 -1.73470120 -2.012862748
## 147 1.116389695 -1.0820305506 -0.5224844 -0.03107419 -1.73470120 -2.052733556
## 148 0.963630408 -1.1085299245 -0.5224844 -0.03107419 -1.73470120 0.383767133
## 149 0.896132119 -1.0758568614 -0.5224844 -0.03107419 -1.73470120 0.003460966
## 150 0.935210076 -1.0777089681 -0.5224844 -0.03107419 -1.73470120 -0.052840120
## 151 1.020471073 -1.0338757744 -0.5224844 -0.03107419 -1.73470120 0.176636095
## 152 1.116389695 -1.0464131126 -0.5224844 -0.03107419 -1.73470120 -0.165113687
## 153 0.690084708 -1.0375799879 -0.5224844 -0.03107419 -1.73470120 -0.146711775
## 154 1.063101572 -1.0314062987 -0.5224844 -0.03107419 -1.73470120 -1.037561447
## 155 0.974288033 -0.9714740229 -0.5224844 -0.03107419 -1.73470120 -0.390537100
## 156 0.498247464 -0.9733261297 -0.5224844 -0.03107419 -1.73470120 -2.942816482
## 157 0.903237202 -0.9776477121 -0.5224844 -0.03107419 -1.73470120 -2.936025300
## 158 1.024023615 -0.9107344185 -0.5224844 -0.03107419 -1.73470120 0.074001626
## 159 1.116389695 -0.9677223194 -0.5224844 -0.03107419 -1.73470120 -0.030494942
## 160 1.116389695 -0.9636381865 -0.5224844 -0.03107419 -1.73470120 0.083640722
## 161 0.853501620 -0.9482039634 -0.5224844 -0.03107419 -1.73470120 -0.194469117
## 162 0.789555872 -0.8662838558 -0.5224844 -0.03107419 -1.73470120 0.194490331
## 163 1.052443947 -0.8331358935 -0.5224844 -0.03107419 -1.73470120 0.360764744
## 164 0.899684660 -0.7755306237 -0.5224844 -0.03107419 -1.73470120 0.348058662
## 165 0.825081288 -0.6520568384 -0.5224844 -0.03107419 -1.73470120 0.421009097
## 166 0.867711786 -0.7178778639 -0.5224844 -0.03107419 -1.73470120 -1.276238619
## 167 0.981393116 -0.8306664178 -0.5224844 -0.03107419 -1.73470120 0.138298780
## 168 0.377461051 -0.6502047316 -0.5224844 -0.03107419 -1.73470120 -1.413705278
## 169 0.977840575 -0.8049743725 -0.5224844 -0.03107419 -1.73470120 -0.652654802
## 170 0.945867701 -0.7278032567 -0.5224844 -0.03107419 -1.73470120 -0.291736362
## 171 0.924552451 -0.6502047316 -0.5224844 -0.03107419 -1.73470120 -0.705231691
## 172 1.020471073 -0.6678709809 -0.5224844 -0.03107419 -1.73470120 -0.093587210
## 173 0.707847416 -0.5693768922 -0.5224844 -0.66594918 -0.85708096 0.440615895
## 174 0.551535588 -0.5455369536 -0.5224844 -0.66594918 -0.85708096 0.425280969
## 175 0.004444187 -0.5191325596 -0.5224844 -0.66594918 -0.85708096 0.400416482
## 176 -1.260260608 -0.3147359550 -0.5224844 -0.66594918 -0.85708096 0.375551994
## 177 -0.759352248 -0.1140435641 -0.5224844 -0.66594918 -0.85708096 0.400416482
## 178 0.171413641 -0.2267846280 -0.5224844 -0.66594918 -0.85708096 0.426376321
## 179 0.206939056 -0.4177890758 -0.5224844 -0.66594918 -0.85708096 0.378947585
## 180 -0.361467593 -0.4587728745 -0.7521778 -1.27709053 -0.30279450 0.440615895
## 181 0.523115255 -0.5005640019 -0.7521778 -1.27709053 -0.30279450 0.425938180
## 182 -0.226471014 -0.5685220737 -0.7521778 -1.27709053 -0.30279450 0.440615895
## 183 0.839291454 -0.5197499285 -0.7521778 -1.27709053 -0.30279450 0.410165113
## 184 0.960077867 -0.4502246894 -0.7521778 -1.27709053 -0.30279450 0.440615895
## 185 0.754030456 -0.3833113958 -0.7521778 -1.27709053 -0.30279450 0.375990135
## 186 0.007996729 -0.2447358168 -0.7521778 -1.27709053 -0.30279450 0.333380947
## 187 -0.531989588 -0.2829652003 -0.7521778 -1.27709053 -0.30279450 0.393844370
## 188 -0.976057283 -0.0030596271 -0.5224844 -0.06074124 -1.50374851 0.407426733
## 189 -1.402362270 0.3664594203 -0.5224844 -0.06074124 -1.50374851 0.286609423
## 190 -1.054213197 0.3664594203 -0.5224844 -0.06074124 -1.50374851 0.440615895
## 191 -1.672355429 1.2749890302 -0.5224844 -0.06074124 -1.50374851 0.230089266
## 192 -1.341969064 1.2749890302 -0.5224844 -0.06074124 -1.50374851 0.361860096
## 193 -1.501833434 1.2749890302 -0.5224844 -0.06074124 -1.50374851 0.370403840
## 194 -2.084450250 1.1514202651 -0.9818712 -0.84988492 -1.31898635 0.401949974
## 195 -1.768274051 1.1514202651 -0.9818712 -0.84988492 -1.31898635 0.219354818
## 196 -1.299338565 0.8801578569 -0.6373311 -0.90921904 -1.87327282 0.411370000
## 197 -1.224735192 1.6687754254 -0.8670245 -0.47014661 -2.70470251 0.440615895
## 198 -1.135921653 1.6687754254 -0.8670245 -0.47014661 -2.70470251 -0.025894464
## 199 -1.075528447 1.6687754254 -0.8670245 -0.47014661 -2.70470251 0.389134357
## 200 -1.892613005 1.8323307009 -0.7521778 -0.03700760 -0.67231881 0.440615895
## 201 -1.942348587 1.8323307009 -0.7521778 -0.03700760 -0.67231881 0.302601560
## 202 -1.071975905 1.1753551835 -0.8670245 -0.35741180 -1.73470120 0.406331382
## 203 -1.878402839 1.1753551835 -0.8670245 -0.35741180 -1.73470120 0.423966547
## 204 -1.256708066 0.6282713349 -0.6373311 -1.09315478 -1.73470120 0.395487398
## 205 -1.302891107 0.6282713349 -0.6373311 -1.09315478 -1.73470120 0.371061052
## 206 -1.643935096 0.0714045634 -0.6373311 -0.77868399 0.06672981 0.440615895
## 207 -0.571067545 0.2658757752 -0.6373311 -0.77868399 0.06672981 0.418380252
## 208 0.146545850 0.2658757752 -0.6373311 -0.77868399 0.06672981 0.358793111
## 209 -0.336599802 0.2109299408 -0.6373311 -0.77868399 0.06672981 0.269960074
## 210 1.116389695 0.0379716616 -0.6373311 -0.77868399 0.06672981 0.440615895
## 211 0.835738912 0.0389689498 -0.6373311 -0.77868399 0.06672981 0.400635552
## 212 0.711399958 -0.0617571650 -0.6373311 -0.77868399 0.06672981 0.422433054
## 213 -0.524884505 -0.0676459148 -0.6373311 -0.77868399 0.06672981 0.375332924
## 214 -1.288680940 0.0714045634 -0.6373311 -0.77868399 0.06672981 0.319141373
## 215 -2.088002791 -0.0985618510 -0.6373311 -0.77868399 0.06672981 -0.084824395
## 216 -0.929874243 0.0714045634 -0.6373311 -0.77868399 0.06672981 0.404797889
## 217 -0.446728591 -0.3243289184 -0.5224844 -0.78461740 -0.94946204 0.395706469
## 218 0.587061003 -0.1775850736 -0.5224844 -0.78461740 -0.94946204 0.395487398
## 219 0.896132119 -0.4301364543 -0.5224844 -0.78461740 -0.94946204 0.440615895
## 220 0.846396537 -0.2050342458 -0.5224844 -0.78461740 -0.94946204 0.406002776
## 221 0.707847416 -0.4432436716 -0.1779443 -0.60068166 -0.48755665 0.383657598
## 222 0.807318580 -0.3547699554 -0.1779443 -0.60068166 -0.48755665 0.422433054
## 223 0.324172928 -0.2483450505 -0.1779443 -0.60068166 -0.48755665 0.369308489
## 224 0.434301716 -0.2483450505 -0.1779443 -0.60068166 -0.48755665 0.440615895
## 225 0.345488177 -0.4277144686 -0.1779443 -0.60068166 -0.48755665 0.310816699
## 226 0.512457630 -0.4277144686 -0.1779443 -0.60068166 -0.48755665 0.277408467
## 227 0.636796585 -0.2751293639 -0.1779443 -0.60068166 -0.48755665 0.336338397
## 228 0.402328842 -0.2751293639 -0.1779443 -0.60068166 -0.48755665 0.168749562
## 229 -1.832219799 -0.1994304356 -0.1779443 -0.60068166 -0.48755665 0.228227168
## 230 -1.675907970 -0.1994304356 -0.1779443 -0.60068166 -0.48755665 0.259225626
## 231 -0.016871062 -0.0586703204 -0.1779443 -0.60068166 -0.48755665 0.237428124
## 232 0.295752595 -0.0586703204 -0.1779443 -0.60068166 -0.48755665 0.213220848
## 233 0.167861099 0.0205903518 -0.1779443 -0.60068166 -0.48755665 0.320236725
## 234 0.064837394 -0.0679783442 -0.1779443 -0.60068166 -0.48755665 0.244000235
## 235 -0.073711727 -0.0679783442 -0.1779443 -0.60068166 -0.48755665 0.038621760
## 236 -0.251338805 -0.0679783442 -0.1779443 -0.60068166 -0.48755665 0.219902494
## 237 0.281542429 0.1676191361 -0.1779443 -0.60068166 -0.48755665 0.348058662
## 238 0.107467893 0.1676191361 -0.1779443 -0.60068166 -0.48755665 0.365803363
## 239 -1.778931675 1.1373157596 -0.4076377 -0.64221553 -0.85708096 0.249038854
## 240 -0.936979326 1.1373157596 -0.4076377 -0.64221553 -0.85708096 0.296905730
## 241 -0.507121797 1.2067460189 -0.4076377 -0.64221553 -0.85708096 0.378728515
## 242 -0.123447309 1.2067460189 -0.4076377 -0.64221553 -0.85708096 0.415641872
## 243 -0.556857379 1.5388905012 -0.4076377 -0.64221553 -0.85708096 0.176088420
## 244 -2.159053622 1.5388905012 -0.4076377 -0.64221553 -0.85708096 0.197557316
## 245 0.281542429 1.9755128019 -0.2927910 -0.46421320 0.29768250 0.173240505
## 246 0.057732311 1.9755128019 -0.2927910 -0.46421320 0.29768250 0.355507055
## 247 -1.196314860 2.0232876588 -0.2927910 -0.46421320 0.29768250 0.367008250
## 248 0.377461051 2.0232876588 -0.2927910 -0.46421320 0.29768250 0.213220848
## 249 -0.691853958 1.9145357480 -0.2927910 -0.46421320 0.29768250 0.197557316
## 250 -1.814457091 1.9145357480 -0.2927910 -0.46421320 0.29768250 0.406002776
## 251 -1.974321461 1.7104240829 -0.2927910 -0.46421320 0.29768250 0.433824713
## 252 -2.119975665 1.7104240829 -0.2927910 -0.46421320 0.29768250 0.223407620
## 253 -2.194579038 2.4275218358 -0.2927910 -0.46421320 0.29768250 0.322208358
## 254 -2.137738373 2.4275218358 -0.2927910 -0.46421320 0.29768250 0.440615895
## 255 -1.299338565 2.5764502168 -0.9818712 -0.55321437 -0.94946204 0.396692285
## 256 -1.757616426 2.5764502168 -0.9818712 -0.55321437 -0.94946204 0.421775843
## 257 -1.221182651 1.2067460189 -0.7521778 -0.97448656 -1.18041474 0.324946738
## 258 0.651006751 -0.9469692255 -0.5224844 -0.85581834 -2.51994036 0.361750561
## 259 1.116389695 -0.9025186628 -0.5224844 -0.85581834 -2.51994036 0.291538506
## 260 1.116389695 -0.8473828687 -0.5224844 -0.85581834 -2.51994036 0.386176907
## 261 0.469827132 -0.7992280924 -0.5224844 -0.85581834 -2.51994036 0.395706469
## 262 0.739820290 -0.7860733853 -0.5224844 -0.85581834 -2.51994036 0.347182381
## 263 0.814423663 -0.7154558781 -0.5224844 -0.85581834 -2.51994036 0.330642568
## 264 0.920999910 -0.8150422349 -0.5224844 -0.85581834 -2.51994036 0.402497650
## 265 0.817976204 -0.8856597421 -0.5224844 -0.85581834 -2.51994036 0.341924692
## 266 -0.205155765 -0.8588754287 -0.5224844 -0.85581834 -2.51994036 0.391325061
## 267 0.569298295 -0.7893501896 -0.5224844 -0.85581834 -2.51994036 0.300082251
## 268 -0.055949019 -0.6522467981 -0.5224844 -0.85581834 -2.51994036 0.305230404
## 269 -0.567515004 -0.4383522101 -0.5224844 -0.85581834 -2.51994036 0.368322672
## 270 -0.251338805 0.0581548764 -0.7521778 -1.09908819 0.06672981 0.379714331
## 271 -0.940531867 0.3010658040 -0.7521778 -1.09908819 0.06672981 0.350249366
## 272 -1.857087590 0.3010658040 -0.7521778 -1.09908819 0.06672981 0.440615895
## 273 -0.350809969 0.0581548764 -0.7521778 -1.09908819 0.06672981 0.419366069
## 274 -0.595935336 0.2713846056 -0.7521778 -1.09908819 0.06672981 0.373470826
## 275 -1.267365691 0.1341862342 -0.6373311 -0.91515245 -0.39517558 0.440615895
## 276 -0.915664077 0.2242746075 -0.6373311 -0.91515245 -0.39517558 0.440615895
## 277 -0.695406500 0.4711746882 -0.6373311 -0.91515245 -0.39517558 0.356821477
## 278 -1.455650394 0.5070770657 -0.6373311 -0.91515245 -0.39517558 0.402826256
## 279 -1.295786023 0.1639624124 -0.6373311 -0.91515245 -0.39517558 0.440615895
## 280 -1.292233482 0.1451564051 -0.5224844 -1.14062207 -1.64232012 0.440615895
## 281 -0.144762558 0.4272465145 -0.5224844 -1.14062207 -1.64232012 0.335571651
## 282 -1.114606404 0.6884410603 -0.5224844 -1.14062207 -1.64232012 0.389462963
## 283 -0.670538709 0.6728643674 -0.5224844 -1.14062207 -1.64232012 0.223407620
## 284 -1.555121557 0.9925190015 -0.9818712 -1.24742347 -2.24279713 0.425500039
## 285 -1.697223220 1.6679680968 -0.9818712 -0.73121670 -1.45755797 0.416737224
## 286 -1.302891107 1.6679680968 -0.9818712 -0.64221553 -1.45755797 0.416737224
## 287 -1.317101273 2.5141909351 -0.9818712 -0.99228679 -0.11803234 -0.165113687
## 288 -1.324206356 1.6726695986 -0.4076377 -0.68374941 -0.85708096 0.440615895
## 289 -0.816192913 1.6726695986 -0.4076377 -0.68374941 -0.85708096 0.440615895
## 290 -1.622619847 1.6726695986 -0.4076377 -0.68374941 -0.85708096 0.164806295
## 291 -1.444992769 0.6276539660 -0.6373311 -0.96855315 0.34387304 0.440615895
## 292 -1.452097852 0.6276539660 -0.6373311 -0.96855315 0.34387304 0.440615895
## 293 -1.604857139 0.6276539660 -0.6373311 -0.96855315 0.34387304 0.440615895
## 294 -1.782484217 0.8109650472 -0.6373311 -0.70748306 -1.13422420 0.440615895
## 295 -0.933426784 0.8109650472 -0.6373311 -0.70748306 -1.13422420 0.440615895
## 296 -1.331311439 1.0283263992 -0.6373311 -0.70748306 -1.13422420 0.440615895
## 297 -0.624355669 1.0283263992 -0.6373311 -0.70748306 -1.13422420 0.396254144
## 298 -0.375677759 1.1991001422 -0.6373311 -0.70748306 -1.13422420 0.440615895
## 299 -1.722091011 1.9151531169 -0.5224844 -0.29807769 -1.68851066 0.126688050
## 300 -2.080897708 1.9151531169 -0.5224844 -0.29807769 -1.68851066 0.163272803
## 301 -0.752247165 1.9151531169 -0.5224844 -0.29807769 -1.68851066 0.374456642
## 302 -1.000925074 0.8057411563 -0.2927910 -0.47014661 -1.08803366 0.428019349
## 303 -1.782484217 0.8057411563 -0.2927910 -0.47014661 -1.08803366 0.295043632
## 304 -1.807352008 0.8057411563 -0.2927910 -0.47014661 -1.08803366 0.369746629
## 305 -0.976057283 0.1077818401 -0.2927910 -1.10502160 -0.02565127 0.405345565
## 306 -0.372125218 -0.2018524214 -0.2927910 -1.10502160 -0.02565127 0.401840439
## 307 0.118125517 -0.3304551177 -0.2927910 -1.10502160 -0.02565127 0.440615895
## 308 0.061284852 -0.2908010367 -0.2927910 -1.10502160 -0.02565127 0.440615895
## 309 0.494694923 -0.2267846280 -0.6373311 -0.61848189 -0.02565127 0.440615895
## 310 0.288647512 -0.3288879504 -0.6373311 -0.61848189 -0.02565127 0.433386573
## 311 -1.093291155 -0.6058016588 -0.6373311 -0.61848189 -0.02565127 -0.068175046
## 312 -0.560409921 -0.5483863487 -0.6373311 -0.61848189 -0.02565127 0.440615895
## 313 0.775345706 -0.4563983787 -0.6373311 -0.61848189 -0.02565127 0.434043784
## 314 0.505352547 -0.2527616128 -0.6373311 -0.61848189 -0.02565127 0.402169045
## 315 0.665216917 -0.0915333432 -0.6373311 -0.61848189 -0.02565127 0.427362137
## 316 0.324172928 0.0712146037 -0.6373311 -0.61848189 -0.02565127 0.435358206
## 317 0.519562713 0.0966691995 -0.6373311 -0.61848189 -0.02565127 0.372704079
## 318 0.111020434 0.1123883621 -0.6373311 -0.61848189 -0.02565127 0.440615895
## 319 -0.048843936 -0.1246813056 -0.6373311 -0.61848189 -0.02565127 0.422104448
## 320 -0.347257427 0.0982363667 -0.6373311 -0.61848189 -0.02565127 0.433277038
## 321 -0.578172628 0.3539695720 -0.5224844 -0.71934988 0.52863520 0.440615895
## 322 -0.507121797 0.3539695720 -0.5224844 -0.71934988 0.52863520 0.440615895
## 323 -0.663433626 0.4397838527 -0.5224844 -0.71934988 0.52863520 0.440615895
## 324 0.203386515 0.4397838527 -0.5224844 -0.71934988 0.52863520 0.377414092
## 325 -1.011582699 0.4397838527 -0.5224844 -0.71934988 0.52863520 0.440615895
## 326 -1.913928255 0.7697437989 -0.5224844 -0.71934988 0.52863520 0.405345565
## 327 -1.409467353 0.7697437989 -0.5224844 -0.71934988 0.52863520 0.440615895
## 328 -0.883691203 0.7697437989 -0.5224844 -0.71934988 0.52863520 0.440615895
## 329 -1.519596142 0.6741465952 -0.6373311 0.12912791 -0.71850935 0.282228015
## 330 -1.825114716 0.6741465952 -0.6373311 0.12912791 -0.71850935 0.203034075
## 331 -1.292233482 0.9871051509 -0.6373311 0.12912791 -0.71850935 0.130302712
## 332 -1.427230061 1.3514003073 -0.9818712 -0.61848189 -0.71850935 0.409069761
## 333 -1.608409681 1.3514003073 -0.9818712 -0.61848189 -0.71850935 0.061076474
## 334 -1.082633530 1.2648261879 -0.5224844 -1.09315478 0.80577843 0.361860096
## 335 -1.068423364 1.2648261879 -0.5224844 -1.09315478 0.80577843 0.358464505
## 336 -1.210525026 1.0401513886 -0.5224844 -1.09315478 0.80577843 0.440615895
## 337 -0.791325122 0.6819824315 -0.5224844 -1.09315478 0.80577843 0.440615895
## 338 -0.318837095 0.8642962245 -0.5224844 -1.09315478 0.80577843 0.417723041
## 339 -1.111053862 0.4830471675 -0.5224844 -1.09315478 0.80577843 0.432291221
## 340 -0.823297996 0.4830471675 -0.5224844 -1.09315478 0.80577843 0.440615895
## 341 -0.357915052 0.4830471675 -0.5224844 -1.09315478 0.80577843 0.440615895
## 342 -0.684748875 1.5400302593 -0.9818712 -0.73715011 -1.36517689 0.416956295
## 343 -0.315284553 1.1738829960 -0.9818712 0.08166062 -1.18041474 0.364598476
## 344 -0.432518424 0.9199069177 -0.5224844 -0.22687676 -0.39517558 0.440615895
## 345 -1.437887686 1.2681504821 -0.5224844 -0.22687676 -0.39517558 0.342800973
## 346 -0.713169208 2.0033893834 -0.7521778 -0.33367816 0.15911089 0.317279275
## 347 -0.578172628 2.0033893834 -0.7521778 -0.33367816 0.15911089 0.086926778
## 348 -1.452097852 2.2511442825 -0.6373311 -0.33961157 -0.25660396 0.391653667
## 349 -1.381047021 2.1602960705 -0.6373311 -0.76088376 -0.67231881 0.375332924
## 350 -1.210525026 2.3730983904 -0.9818712 -0.43454615 0.57482574 0.363393588
## 351 -0.858823412 2.3730983904 -0.9818712 -0.43454615 0.57482574 0.440615895
## 352 -1.160789444 3.2840499862 -0.6373311 0.01639310 -0.07184181 0.154509988
## 353 -1.778931675 3.2840499862 -0.6373311 0.01639310 -0.07184181 0.390558315
## 354 -1.153684361 3.9566021965 -0.5224844 -1.31269099 -0.67231881 0.304354123
## 355 -1.658145262 3.2248775491 -0.6373311 -0.44047956 1.63720813 0.286171282
## 356 -1.743406260 3.2248775491 -0.6373311 -0.44047956 1.63720813 0.212125496
## 357 1.024023615 -0.7944316108 1.6596029 1.52941294 0.80577843 0.230636942
## 358 0.796660955 -0.6125452271 1.6596029 1.52941294 0.80577843 0.379714331
## 359 0.526667797 -0.5092546567 1.6596029 1.52941294 0.80577843 0.424514223
## 360 0.452064424 -0.6106931203 1.6596029 1.52941294 0.80577843 0.373142220
## 361 0.690084708 -0.6063715378 1.6596029 1.52941294 0.80577843 0.195914288
## 362 0.800213497 -0.7121315839 1.6596029 1.52941294 0.80577843 -0.065984343
## 363 0.981393116 -0.8032647354 1.6596029 1.52941294 0.80577843 0.264154709
## 364 0.725610124 -0.8977221812 1.6596029 1.52941294 0.80577843 -0.039805433
## 365 0.508905089 -0.8977221812 1.6596029 1.52941294 0.80577843 -0.023265620
## 366 0.686532167 -1.0361552904 1.6596029 1.52941294 0.80577843 -0.021622592
## 367 0.810871121 -0.9700968153 1.6596029 1.52941294 0.80577843 -0.445195159
## 368 1.116389695 -1.0848799457 1.6596029 1.52941294 0.80577843 -2.467324237
## 369 1.116389695 -1.1694594886 1.6596029 1.52941294 0.80577843 0.206429666
## 370 1.002708366 -1.1579669285 1.6596029 1.52941294 0.80577843 0.204348498
## 371 1.027576156 -1.2312438711 1.6596029 1.52941294 0.80577843 0.387491330
## 372 1.116389695 -1.2470580136 1.6596029 1.52941294 0.80577843 0.103795196
## 373 0.746925373 -1.2658165310 1.6596029 1.52941294 0.80577843 -0.096325589
## 374 1.116389695 -1.2446360278 1.6596029 1.52941294 0.80577843 0.440615895
## 375 1.116389695 -1.2623022771 1.6596029 1.52941294 0.80577843 0.440615895
## 376 1.041786323 -1.1771528552 1.6596029 1.52941294 0.80577843 0.440615895
## 377 0.878369411 -1.1635707388 1.6596029 1.52941294 0.80577843 0.069510683
## 378 1.073759197 -1.1573495596 1.6596029 1.52941294 0.80577843 0.440615895
## 379 0.981393116 -1.1440048928 1.6596029 1.52941294 0.80577843 0.440615895
## 380 1.116389695 -1.1440048928 1.6596029 1.52941294 0.80577843 0.406002776
## 381 0.828633829 -1.1295679579 1.6596029 1.52941294 0.80577843 0.440615895
## 382 1.084416821 -1.0807958128 1.6596029 1.52941294 0.80577843 0.440615895
## 383 1.116389695 -1.0517319833 1.6596029 1.52941294 0.80577843 0.440615895
## 384 1.116389695 -1.0741947142 1.6596029 1.52941294 0.80577843 0.440615895
## 385 0.803766038 -1.1186452769 1.6596029 1.52941294 0.80577843 -0.775991422
## 386 1.048891406 -1.1250089259 1.6596029 1.52941294 0.80577843 0.440615895
## 387 1.116389695 -1.1054905698 1.6596029 1.52941294 0.80577843 0.440615895
## 388 0.743372832 -1.0811757321 1.6596029 1.52941294 0.80577843 0.440615895
## 389 1.116389695 -1.0474104008 1.6596029 1.52941294 0.80577843 0.177950518
## 390 1.077311738 -0.9815893753 1.6596029 1.52941294 0.80577843 0.440615895
## 391 1.009813449 -0.8873693792 1.6596029 1.52941294 0.80577843 0.413560704
## 392 0.494694923 -0.7727762084 1.6596029 1.52941294 0.80577843 0.237756730
## 393 1.009813449 -0.9616910999 1.6596029 1.52941294 0.80577843 0.440615895
## 394 0.853501620 -0.9516232374 1.6596029 1.52941294 0.80577843 0.440615895
## 395 0.928104993 -0.9559448199 1.6596029 1.52941294 0.80577843 0.440615895
## 396 1.073759197 -0.9827291333 1.6596029 1.52941294 0.80577843 0.386724583
## 397 0.974288033 -1.0059517029 1.6596029 1.52941294 0.80577843 0.440615895
## 398 1.077311738 -1.0265623271 1.6596029 1.52941294 0.80577843 0.398992524
## 399 1.116389695 -1.0948528283 1.6596029 1.52941294 0.80577843 0.440615895
## 400 0.327725469 -1.0897239172 1.6596029 1.52941294 0.80577843 -0.202793791
## 401 1.116389695 -1.0477428302 1.6596029 1.52941294 0.80577843 0.440615895
## 402 1.116389695 -1.0547238481 1.6596029 1.52941294 0.80577843 0.440615895
## 403 1.116389695 -1.0239028917 1.6596029 1.52941294 0.80577843 0.212892242
## 404 0.974288033 -0.9936043244 1.6596029 1.52941294 0.80577843 0.440615895
## 405 0.597718628 -1.0389097056 1.6596029 1.52941294 0.80577843 -0.298089403
## 406 1.116389695 -1.1253413553 1.6596029 1.52941294 0.80577843 0.309940417
## 407 1.116389695 -1.2427839210 1.6596029 1.52941294 0.80577843 0.148376017
## 408 1.116389695 -1.1919222195 1.6596029 1.52941294 0.80577843 -0.269281649
## 409 1.041786323 -1.1114268095 1.6596029 1.52941294 0.80577843 -0.460420549
## 410 1.116389695 -1.1062978984 1.6596029 1.52941294 0.80577843 -1.942212553
## 411 1.116389695 -1.1312301050 1.6596029 1.52941294 0.80577843 -3.878356510
## 412 1.116389695 -1.0768541496 1.6596029 1.52941294 0.80577843 -3.522914830
## 413 1.116389695 -1.0643168114 1.6596029 1.52941294 0.80577843 -3.591483857
## 414 1.116389695 -1.0474578907 1.6596029 1.52941294 0.80577843 -1.595971828
## 415 1.116389695 -1.0147848276 1.6596029 1.52941294 0.80577843 -2.939968567
## 416 1.116389695 -0.9309651233 1.6596029 1.52941294 0.80577843 -3.608352275
## 417 0.789555872 -0.9381835908 1.6596029 1.52941294 0.80577843 -3.670568261
## 418 0.729162665 -1.0198662487 1.6596029 1.52941294 0.80577843 -2.511795523
## 419 1.116389695 -0.9462093868 1.6596029 1.52941294 0.80577843 -3.726650277
## 420 0.281542429 -0.9502935197 1.6596029 1.52941294 0.80577843 -3.376137680
## 421 1.116389695 -0.9194725633 1.6596029 1.52941294 0.80577843 -0.415401588
## 422 0.949420242 -0.9120166463 1.6596029 1.52941294 0.80577843 -0.401928760
## 423 0.675874542 -0.8756393696 1.6596029 1.52941294 0.80577843 -0.713337295
## 424 0.587061003 -0.8421114879 1.6596029 1.52941294 0.80577843 -3.879232792
## 425 0.071942477 -0.8223081923 1.6596029 1.52941294 0.80577843 -3.866855315
## 426 0.952972784 -0.8953951752 1.6596029 1.52941294 0.80577843 -3.822712635
## 427 -0.315284553 -0.8536040479 1.6596029 1.52941294 0.80577843 -3.636831424
## 428 0.359698343 -0.9175729666 1.6596029 1.52941294 0.80577843 -3.700690438
## 429 0.338383094 -0.8830477967 1.6596029 1.52941294 0.80577843 -2.847301799
## 430 0.960077867 -0.8675660836 1.6596029 1.52941294 0.80577843 -3.241738006
## 431 0.622586419 -0.8274371034 1.6596029 1.52941294 0.80577843 -2.992764527
## 432 0.913894827 -0.8105781827 1.6596029 1.52941294 0.80577843 -3.015985986
## 433 0.221149222 -0.7572944954 1.6596029 1.52941294 0.80577843 -2.833938506
## 434 0.686532167 -0.7024911307 1.6596029 1.52941294 0.80577843 -2.809402625
## 435 0.938762618 -0.7469416934 1.6596029 1.52941294 0.80577843 -2.804583076
## 436 0.924552451 -0.7932443629 1.6596029 1.52941294 0.80577843 -2.703591634
## 437 0.878369411 -0.8512295520 1.6596029 1.52941294 0.80577843 -3.605723431
## 438 1.116389695 -0.8932106390 1.6596029 1.52941294 0.80577843 -3.804748865
## 439 0.686532167 -0.9376612017 1.6596029 1.52941294 0.80577843 -3.151590547
## 440 0.899684660 -0.9392758589 1.6596029 1.52941294 0.80577843 0.440615895
## 441 0.846396537 -0.9160057994 1.6596029 1.52941294 0.80577843 0.380919218
## 442 1.016918532 -0.8215483536 1.6596029 1.52941294 0.80577843 0.320784401
## 443 1.116389695 -0.8501847738 1.6596029 1.52941294 0.80577843 0.427362137
## 444 1.116389695 -0.8627221120 1.6596029 1.52941294 0.80577843 0.329218610
## 445 0.995603282 -0.9020437636 1.6596029 1.52941294 0.80577843 -1.272295352
## 446 0.931657534 -0.8582105699 1.6596029 1.52941294 0.80577843 -3.435177145
## 447 0.988498199 -0.8182715493 1.6596029 1.52941294 0.80577843 -0.423507192
## 448 0.995603282 -0.7584342534 1.6596029 1.52941294 0.80577843 0.348825409
## 449 1.070206655 -0.7282306659 1.6596029 1.52941294 0.80577843 0.440615895
## 450 1.055996489 -0.7646079427 1.6596029 1.52941294 0.80577843 -0.574665749
## 451 0.853501620 -0.6987869171 1.6596029 1.52941294 0.80577843 -3.903330533
## 452 1.052443947 -0.6837801032 1.6596029 1.52941294 0.80577843 -0.015160016
## 453 0.825081288 -0.6776064140 1.6596029 1.52941294 0.80577843 0.311254840
## 454 1.091521905 -0.6374774338 1.6596029 1.52941294 0.80577843 0.210263398
## 455 0.906789743 -0.6168668096 1.6596029 1.52941294 0.80577843 -3.833666154
## 456 0.636796585 -0.6455032298 1.6596029 1.52941294 0.80577843 -3.349082489
## 457 0.686532167 -0.5767378294 1.6596029 1.52941294 0.80577843 -3.792042783
## 458 0.416539008 -0.4824228534 1.6596029 1.52941294 0.80577843 -3.868498343
## 459 0.537325421 -0.4805707466 1.6596029 1.52941294 0.80577843 -0.925178346
## 460 0.562193212 -0.5117241325 1.6596029 1.52941294 0.80577843 0.440615895
## 461 0.761135540 -0.5687120333 1.6596029 1.52941294 0.80577843 -1.111169093
## 462 0.704294875 -0.5831489682 1.6596029 1.52941294 0.80577843 0.380700148
## 463 0.512457630 -0.5036983364 1.6596029 1.52941294 0.80577843 0.440615895
## 464 0.757582998 -0.4717851119 1.6596029 1.52941294 0.80577843 0.406879058
## 465 -0.112789684 -0.3949464255 1.6596029 1.52941294 0.80577843 0.440615895
## 466 -0.723826832 -0.3459843207 1.6596029 1.52941294 0.80577843 -0.243979021
## 467 0.572850837 -0.4385896596 1.6596029 1.52941294 0.80577843 -3.665748713
## 468 0.920999910 -0.5958762661 1.6596029 1.52941294 0.80577843 -0.278044464
## 469 0.086152643 -0.4210658801 1.6596029 1.52941294 0.80577843 0.132164810
## 470 -0.421860800 -0.4612898402 1.6596029 1.52941294 0.80577843 0.440615895
## 471 0.547983046 -0.3617034834 1.6596029 1.52941294 0.80577843 0.440615895
## 472 0.786003330 -0.3304076278 1.6596029 1.52941294 0.80577843 0.423418871
## 473 0.228254306 -0.4267171803 1.6596029 1.52941294 0.80577843 0.401949974
## 474 -0.034633770 -0.5993905200 1.6596029 1.52941294 0.80577843 0.197228711
## 475 0.952972784 -0.6483526248 1.6596029 1.52941294 0.80577843 -0.044844052
## 476 1.024023615 -0.7546350600 1.6596029 1.52941294 0.80577843 -0.590548351
## 477 0.889027036 -0.7074775720 1.6596029 1.52941294 0.80577843 0.433057967
## 478 1.020471073 -0.8046419430 1.6596029 1.52941294 0.80577843 -0.078799960
## 479 0.999155824 -0.7714939807 1.6596029 1.52941294 0.80577843 0.252215374
## 480 0.690084708 -0.8756393696 1.6596029 1.52941294 0.80577843 0.291867112
## 481 -0.137657475 -0.1761128861 1.6596029 1.52941294 0.80577843 0.440615895
## 482 0.224701764 -0.2200410597 1.6596029 1.52941294 0.80577843 0.398663919
## 483 0.299305137 -0.1825715149 1.6596029 1.52941294 0.80577843 0.422871195
## 484 -1.004477616 0.1440166471 1.6596029 1.52941294 0.80577843 0.397020891
## 485 -0.947636951 -0.0337381137 1.6596029 1.52941294 0.80577843 0.153962312
## 486 -0.592382795 0.0933923952 1.6596029 1.52941294 0.80577843 0.349920761
## 487 0.398776300 -0.1183176566 1.6596029 1.52941294 0.80577843 0.394392046
## 488 -0.546199754 -0.3052379716 1.6596029 1.52941294 0.80577843 0.345539353
## 489 0.857054162 -0.9375187319 -0.6373311 1.79641644 0.75958789 0.420790026
## 490 1.055996489 -0.9686246278 -0.6373311 1.79641644 0.75958789 -0.138277566
## 491 1.045338864 -0.9367114033 -0.6373311 1.79641644 0.75958789 -0.418906714
## 492 1.073759197 -0.9151034909 -0.6373311 1.79641644 0.75958789 0.366241503
## 493 0.530220338 -0.8002728706 -0.6373311 1.79641644 0.75958789 0.440615895
## 494 -0.517779422 -0.6711952751 -0.4076377 -0.10227512 0.34387304 0.440615895
## 495 -0.922769160 -0.6711952751 -0.4076377 -0.10227512 0.34387304 0.440615895
## 496 -1.413019895 -0.4732098094 -0.4076377 -0.10227512 0.34387304 0.401073693
## 497 0.153650933 -0.4732098094 -0.4076377 -0.10227512 0.34387304 0.440615895
## 498 0.071942477 -0.4285217972 -0.4076377 -0.10227512 0.34387304 0.440615895
## 499 -0.116342226 -0.6581830377 -0.4076377 -0.10227512 0.34387304 0.440615895
## 500 0.174966182 -0.6625521101 -0.4076377 -0.10227512 0.34387304 0.428238419
## 501 0.395223759 -0.6158695213 -0.4076377 -0.10227512 0.34387304 0.440615895
## 502 0.018654354 -0.6251775451 -0.9818712 -0.80241764 1.17530274 0.386834118
## 503 0.288647512 -0.7159307773 -0.9818712 -0.80241764 1.17530274 0.440615895
## 504 0.796660955 -0.7729186782 -0.9818712 -0.80241764 1.17530274 0.440615895
## 505 0.736267749 -0.6677760011 -0.9818712 -0.80241764 1.17530274 0.402826256
## 506 0.434301716 -0.6126402069 -0.9818712 -0.80241764 1.17530274 0.440615895
## lstat medv
## 1 -1.074498970 0.159527789
## 2 -0.491952525 -0.101423917
## 3 -1.207532413 1.322937477
## 4 -1.360170785 1.181588636
## 5 -1.025486649 1.486032293
## 6 -1.042290874 0.670558212
## 7 -0.031236706 0.039924923
## 8 0.909799859 0.496590409
## 9 2.419379350 -0.655946292
## 10 0.622727693 -0.394994586
## 11 1.091845624 -0.819041108
## 12 0.086392864 -0.394994586
## 13 0.428078760 -0.090550930
## 14 -0.615183504 -0.231899770
## 15 -0.335113097 -0.471105500
## 16 -0.585776111 -0.286264709
## 17 -0.850442645 0.061670899
## 18 0.282442149 -0.547216415
## 19 -0.134862757 -0.253645746
## 20 -0.192277190 -0.471105500
## 21 1.171665689 -0.971262937
## 22 0.164812578 -0.318883672
## 23 0.849584722 -0.797295133
## 24 1.012025558 -0.873406047
## 25 0.510699530 -0.753803182
## 26 0.540106923 -0.938643973
## 27 0.302047077 -0.645073304
## 28 0.647934029 -0.840787084
## 29 0.020576319 -0.449359525
## 30 -0.094252548 -0.166661844
## 31 1.392921311 -1.069119826
## 32 0.054184768 -0.873406047
## 33 2.108501199 -1.014754888
## 34 0.797771697 -1.025627875
## 35 1.076441751 -0.982135924
## 36 -0.416333515 -0.394994586
## 37 -0.174072614 -0.275391721
## 38 -0.543765550 -0.166661844
## 39 -0.353317674 0.235638703
## 40 -1.166922204 0.898890955
## 41 -1.494604580 1.344683452
## 42 -1.094103899 0.442225470
## 43 -0.958269752 0.300876629
## 44 -0.730012370 0.235638703
## 45 -0.434538092 -0.144915868
## 46 -0.342114857 -0.351502635
## 47 0.209623843 -0.275391721
## 48 0.860787538 -0.645073304
## 49 2.542610329 -0.884279035
## 50 0.496696010 -0.340629648
## 51 0.111599201 -0.308010684
## 52 -0.451342316 -0.221026782
## 53 -1.032488409 0.268257666
## 54 -0.591377519 0.094289862
## 55 0.300646725 -0.394994586
## 56 -1.098304955 1.399048391
## 57 -0.963871160 0.235638703
## 58 -1.218735230 0.985874857
## 59 -0.811232788 0.083416874
## 60 -0.480749709 -0.318883672
## 61 0.069588640 -0.416740562
## 62 0.250234052 -0.710311231
## 63 -0.829437365 -0.036185991
## 64 -0.441539852 0.268257666
## 65 -0.644590896 1.138096685
## 66 -1.117909883 0.105162850
## 67 -0.337913801 -0.340629648
## 68 -0.637589136 -0.057931966
## 69 0.061186528 -0.558089402
## 70 -0.540964846 -0.177534831
## 71 -0.830837717 0.181273764
## 72 -0.388326475 -0.090550930
## 73 -0.998879961 0.029051936
## 74 -0.716008850 0.094289862
## 75 -0.822435605 0.170400776
## 76 -0.519959566 -0.123169893
## 77 -0.095652900 -0.275391721
## 78 -0.333712745 -0.188407819
## 79 -0.043839875 -0.144915868
## 80 -0.497553933 -0.242772758
## 81 -1.031088057 0.594447298
## 82 -0.760820115 0.148654801
## 83 -0.830837717 0.246511690
## 84 -0.720209906 0.039924923
## 85 -0.424735627 0.148654801
## 86 -0.857444405 0.442225470
## 87 0.028978431 -0.003567028
## 88 -0.589977167 -0.036185991
## 89 -1.001680665 0.116035838
## 90 -0.973673624 0.670558212
## 91 -0.538164142 0.007305960
## 92 -0.623585616 -0.057931966
## 93 -0.629187024 0.039924923
## 94 -0.902255670 0.268257666
## 95 -0.288901480 -0.210153795
## 96 -0.840640181 0.637939249
## 97 -0.183875078 -0.123169893
## 98 -1.182326077 1.757856987
## 99 -1.271948607 2.312379361
## 100 -0.905056374 1.159842661
## 101 -0.452742668 0.540082359
## 102 -0.697804274 0.431352482
## 103 -0.283300072 -0.427613550
## 104 0.110198849 -0.351502635
## 105 -0.045240227 -0.264518733
## 106 0.534505515 -0.329756660
## 107 0.841182610 -0.329756660
## 108 0.201221731 -0.231899770
## 109 -0.053642339 -0.297137697
## 110 0.405673128 -0.340629648
## 111 0.048583360 -0.090550930
## 112 -0.349116618 0.029051936
## 113 0.498096362 -0.405867574
## 114 0.621327341 -0.416740562
## 115 -0.308506409 -0.438486537
## 116 0.435080520 -0.460232513
## 117 -0.085850436 -0.144915868
## 118 -0.329511689 -0.362375623
## 119 0.380466791 -0.231899770
## 120 0.134004834 -0.351502635
## 121 0.240431588 -0.057931966
## 122 0.226428068 -0.242772758
## 123 0.738956911 -0.221026782
## 124 1.786420232 -0.568962390
## 125 0.689944590 -0.405867574
## 126 0.302047077 -0.123169893
## 127 2.045485358 -0.742930194
## 128 0.635330861 -0.688565255
## 129 0.383267495 -0.492851476
## 130 0.796371345 -0.895152022
## 131 -0.007430722 -0.362375623
## 132 -0.055042691 -0.318883672
## 133 -0.214682823 0.050797911
## 134 0.332854822 -0.449359525
## 135 0.652135085 -0.753803182
## 136 0.603122764 -0.481978488
## 137 0.594720652 -0.558089402
## 138 0.271239333 -0.590708366
## 139 1.213676250 -1.003881900
## 140 0.813175569 -0.514597451
## 141 1.611376228 -0.927770986
## 142 3.046737061 -0.884279035
## 143 1.983869868 -0.993008912
## 144 1.927855787 -0.753803182
## 145 2.329756820 -1.166976716
## 146 2.121104367 -0.949516961
## 147 0.559711851 -0.753803182
## 148 2.363365269 -0.862533059
## 149 2.193922673 -0.514597451
## 150 1.231880827 -0.775549157
## 151 0.202622083 -0.112296905
## 152 0.087793216 -0.318883672
## 153 -0.074647619 -0.786422145
## 154 0.439281577 -0.340629648
## 155 0.345457990 -0.601581353
## 156 0.331454470 -0.753803182
## 157 0.488293898 -1.025627875
## 158 -1.129112700 2.040554668
## 159 -0.871447926 0.192146752
## 160 -0.737014131 0.083416874
## 161 -1.001680665 0.485717421
## 162 -1.529613381 2.986504601
## 163 -1.503006692 2.986504601
## 164 -1.306957408 2.986504601
## 165 -0.141864517 0.018178948
## 166 -0.398128939 0.268257666
## 167 -1.253744030 2.986504601
## 168 -0.071846915 0.137781813
## 169 -0.217483527 0.137781813
## 170 -0.186675782 -0.025313003
## 171 0.248833700 -0.558089402
## 172 -0.087250788 -0.373248611
## 173 0.285242853 0.061670899
## 174 -0.505956045 0.116035838
## 175 -0.421934923 0.007305960
## 176 -1.025486649 0.746669127
## 177 -0.356118378 0.072543887
## 178 -0.891052854 0.224765715
## 179 -0.802830676 0.801034065
## 180 -1.066096858 1.594762170
## 181 -0.713208146 1.877459852
## 182 -0.448541612 1.486032293
## 183 -1.096904603 1.670873085
## 184 -0.976474328 1.083731747
## 185 0.185817859 0.420479494
## 186 0.069588640 0.768415102
## 187 -1.148717628 2.986504601
## 188 -0.836439125 1.029366808
## 189 -1.133313756 0.790161078
## 190 -1.017084537 1.344683452
## 191 -1.057694746 1.573016195
## 192 -1.115109179 0.866271992
## 193 -1.369973249 1.507778268
## 194 -1.067497210 0.931509918
## 195 -1.158520092 0.714050163
## 196 -1.355969729 2.986504601
## 197 -1.200530653 1.170715648
## 198 -0.566171183 0.844526016
## 199 -0.844841237 1.312064489
## 200 -1.133313756 1.344683452
## 201 -1.148717628 1.127223698
## 202 -0.731412722 0.170400776
## 203 -1.336364800 2.149284545
## 204 -1.238340158 2.823409785
## 205 -1.368572897 2.986504601
## 206 -0.249691623 0.007305960
## 207 -0.235688103 0.203019739
## 208 0.757161488 -0.003567028
## 209 0.281041797 0.203019739
## 210 1.461538560 -0.275391721
## 211 0.646533677 -0.090550930
## 212 1.586169891 -0.351502635
## 213 0.472890025 -0.014440015
## 214 -0.458344076 0.605320286
## 215 2.366165973 0.126908825
## 216 -0.445740908 0.268257666
## 217 0.120001313 0.083416874
## 218 -0.414933163 0.670558212
## 219 0.737556559 -0.112296905
## 220 -0.301504649 0.050797911
## 221 -0.412132459 0.453098458
## 222 1.233281179 -0.090550930
## 223 -0.381324714 0.540082359
## 224 -0.707606738 0.822780041
## 225 -1.192128541 2.421109239
## 226 -1.123511291 2.986504601
## 227 -1.333564096 1.638254121
## 228 -0.881250390 0.985874857
## 229 -1.222936286 2.627696006
## 230 -1.245341918 0.975001869
## 231 -0.140464165 0.192146752
## 232 -1.036689465 0.996747845
## 233 -1.425987330 2.084046619
## 234 -1.218735230 2.801663810
## 235 -0.644590896 0.703177176
## 236 -0.248291271 0.159527789
## 237 -0.435938444 0.279130654
## 238 -1.109507771 0.975001869
## 239 -0.881250390 0.126908825
## 240 -0.739814835 0.083416874
## 241 -0.178273670 -0.057931966
## 242 -0.035437762 -0.264518733
## 243 -0.200679302 -0.036185991
## 244 -1.045091578 0.126908825
## 245 -0.021434242 -0.536343427
## 246 0.813175569 -0.438486537
## 247 -0.489151821 0.192146752
## 248 -0.350516970 -0.221026782
## 249 -0.438739148 0.213892727
## 250 -0.853243349 0.398733519
## 251 -0.945666583 0.203019739
## 252 -1.269147903 0.246511690
## 253 -1.277550015 0.768415102
## 254 -1.276149663 2.203649484
## 255 -0.851842997 -0.068804954
## 256 -0.476548653 -0.177534831
## 257 -1.336364800 2.334125337
## 258 -1.054894042 2.986504601
## 259 -0.681000049 1.464286318
## 260 -0.805631380 0.822780041
## 261 -0.428936683 1.225080587
## 262 -0.755218707 2.236268447
## 263 -0.944266231 2.856028748
## 264 -0.196478246 0.920636930
## 265 -0.637589136 1.518651256
## 266 -0.308506409 0.029051936
## 267 0.299246373 0.888017967
## 268 -0.730012370 2.986504601
## 269 -1.329363040 2.279760398
## 270 0.139606242 -0.199280807
## 271 0.048583360 -0.155788856
## 272 -0.849042293 0.290003641
## 273 -0.689402161 0.203019739
## 274 -0.850442645 1.377302416
## 275 -1.277550015 1.072858759
## 276 -1.354569377 1.029366808
## 277 -0.924661303 1.159842661
## 278 -1.189327837 1.148969673
## 279 -0.765021171 0.714050163
## 280 -1.092703547 1.366429428
## 281 -1.245341918 2.486347165
## 282 -1.129112700 1.399048391
## 283 -1.350368321 2.551585092
## 284 -1.329363040 2.986504601
## 285 -0.672597937 1.051112783
## 286 -0.619384560 -0.057931966
## 287 0.038780895 -0.264518733
## 288 -0.772022931 0.072543887
## 289 -0.707606738 -0.025313003
## 290 -0.440139500 0.246511690
## 291 -1.305557056 0.648812237
## 292 -1.273348959 1.605635158
## 293 -1.113708827 0.583574310
## 294 -0.570372239 0.148654801
## 295 -0.315508169 -0.090550930
## 296 -0.893853558 0.659685225
## 297 -0.737014131 0.496590409
## 298 0.446283337 -0.242772758
## 299 -1.075899322 -0.003567028
## 300 -1.108107419 0.703177176
## 301 -0.921860599 0.246511690
## 302 -0.441539852 -0.057931966
## 303 -0.557769070 0.420479494
## 304 -1.091303195 1.148969673
## 305 -0.801430324 1.475159305
## 306 -0.521359918 0.637939249
## 307 -0.865846518 1.181588636
## 308 -0.717409202 0.616193274
## 309 -1.136114460 0.029051936
## 310 -0.375723306 -0.242772758
## 311 -0.001829314 -0.699438243
## 312 -0.934463767 -0.047058979
## 313 -0.130661701 -0.340629648
## 314 -0.665596177 -0.101423917
## 315 -0.472347596 0.137781813
## 316 -0.161469445 -0.688565255
## 317 0.794970993 -0.514597451
## 318 0.460286857 -0.297137697
## 319 -0.321109577 0.061670899
## 320 0.010773855 -0.166661844
## 321 -0.763620819 0.137781813
## 322 -0.809832436 0.061670899
## 323 -0.693603218 -0.231899770
## 324 -0.127860997 -0.438486537
## 325 -0.914858839 0.268257666
## 326 -1.060495450 0.224765715
## 327 -0.910657783 0.050797911
## 328 0.019175967 -0.036185991
## 329 -0.375723306 -0.351502635
## 330 -0.744015891 0.007305960
## 331 -0.498954285 -0.297137697
## 332 -0.031236706 -0.590708366
## 333 -0.675398641 -0.340629648
## 334 -0.976474328 -0.036185991
## 335 -0.826636661 -0.199280807
## 336 -0.650192305 -0.155788856
## 337 -0.399529291 -0.329756660
## 338 -0.293102536 -0.438486537
## 339 -0.580174703 -0.210153795
## 340 -0.407931403 -0.384121599
## 341 -0.470947244 -0.416740562
## 342 -1.003081017 1.105477722
## 343 -0.560569774 -0.655946292
## 344 -0.766421523 0.148654801
## 345 -1.126311996 0.942382906
## 346 -0.297303592 -0.547216415
## 347 0.002371742 -0.579835378
## 348 -0.881250390 0.061670899
## 349 -0.933063415 0.213892727
## 350 -0.947066935 0.442225470
## 351 -0.934463767 0.039924923
## 352 -1.003081017 0.170400776
## 353 -0.681000049 -0.427613550
## 354 -1.141715868 0.822780041
## 355 -0.644590896 -0.471105500
## 356 -0.991878200 -0.210153795
## 357 0.692745294 -0.514597451
## 358 0.086392864 -0.090550930
## 359 -0.164270149 0.018178948
## 360 0.002371742 0.007305960
## 361 -0.681000049 0.268257666
## 362 0.215225251 -0.286264709
## 363 -0.344915562 -0.188407819
## 364 0.278241093 -0.623327329
## 365 -1.031088057 -0.068804954
## 366 -0.774823635 0.540082359
## 367 0.188618563 -0.068804954
## 368 0.094794977 0.061670899
## 369 -1.315359520 2.986504601
## 370 -1.249542974 2.986504601
## 371 -1.357370081 2.986504601
## 372 -0.437338796 2.986504601
## 373 -0.528361678 2.986504601
## 374 3.097149734 -0.949516961
## 375 3.545262384 -0.949516961
## 376 0.110198849 -0.819041108
## 377 1.482543841 -0.938643973
## 378 1.202473434 -1.003881900
## 379 1.545559682 -1.025627875
## 380 1.278092444 -1.340944520
## 381 0.638131565 -1.319198544
## 382 1.180067802 -1.264833606
## 383 1.532956514 -1.221341655
## 384 1.667390309 -1.112611777
## 385 2.517403992 -1.493166348
## 386 2.542610329 -1.667134152
## 387 2.188321265 -1.308325557
## 388 2.707851869 -1.645388177
## 389 2.516003640 -1.340944520
## 390 1.147859705 -1.199595679
## 391 0.624128045 -0.808168120
## 392 0.855186130 0.072543887
## 393 1.824229736 -1.395309459
## 394 0.352459751 -0.949516961
## 395 0.517701290 -1.069119826
## 396 0.625528397 -1.025627875
## 397 0.940607604 -1.090865802
## 398 1.017626966 -1.525785311
## 399 2.511802584 -1.906339882
## 400 2.424980758 -1.764991042
## 401 1.976868108 -1.841101956
## 402 1.073641047 -1.667134152
## 403 1.072240695 -1.134357753
## 404 0.996621685 -1.547531287
## 405 2.062289582 -1.525785311
## 406 1.446134688 -1.906339882
## 407 1.496547361 -1.156103728
## 408 -0.073247267 0.583574310
## 409 1.925055083 -0.579835378
## 410 0.998022037 0.540082359
## 411 -0.356118378 -0.819041108
## 412 1.199672730 -0.579835378
## 413 3.041135653 -0.503724464
## 414 1.040032598 -0.677692268
## 415 3.406627533 -1.688880128
## 416 2.296148371 -1.667134152
## 417 1.839633609 -1.634515189
## 418 1.958663532 -1.319198544
## 419 1.115651608 -1.493166348
## 420 1.412526239 -1.536658299
## 421 0.331454470 -0.634200317
## 422 0.426678408 -0.906025010
## 423 0.202622083 -0.188407819
## 424 1.489545601 -0.993008912
## 425 0.631129805 -1.177849704
## 426 1.643584324 -1.547531287
## 427 0.425278056 -1.340944520
## 428 0.261436868 -1.264833606
## 429 1.241683291 -1.253960618
## 430 1.600173411 -1.417055434
## 431 0.698346703 -0.873406047
## 432 0.985418869 -0.916897998
## 433 -0.087250788 -0.699438243
## 434 0.499496714 -0.895152022
## 435 0.352459751 -1.177849704
## 436 1.486744897 -0.993008912
## 437 0.755761136 -1.406182446
## 438 1.932056843 -1.504039336
## 439 2.992123331 -1.536658299
## 440 1.432131167 -1.058246839
## 441 1.324304061 -1.308325557
## 442 0.961612885 -0.590708366
## 443 0.551309739 -0.449359525
## 444 0.867789298 -0.775549157
## 445 1.559563202 -1.275706593
## 446 1.586169891 -1.166976716
## 447 0.719351983 -0.829914096
## 448 0.530304459 -1.079992814
## 449 0.766963952 -0.916897998
## 450 0.932205492 -1.036500863
## 451 0.670339662 -0.993008912
## 452 0.710949871 -0.797295133
## 453 0.646533677 -0.699438243
## 454 0.572315020 -0.514597451
## 455 0.848184370 -0.829914096
## 456 0.766963952 -0.916897998
## 457 0.890194931 -1.069119826
## 458 0.600322060 -0.982135924
## 459 0.500897066 -0.829914096
## 460 0.286643205 -0.275391721
## 461 0.527503755 -0.666819280
## 462 0.279641445 -0.525470439
## 463 0.187218211 -0.329756660
## 464 -0.330912041 -0.253645746
## 465 0.079391104 -0.123169893
## 466 0.206823139 -0.286264709
## 467 0.629729453 -0.384121599
## 468 1.213676250 -0.373248611
## 469 0.766963952 -0.373248611
## 470 0.295045317 -0.264518733
## 471 0.509299178 -0.286264709
## 472 0.030378783 -0.318883672
## 473 0.239031236 0.072543887
## 474 -0.139063813 0.790161078
## 475 0.768364304 -0.949516961
## 476 1.602974115 -1.003881900
## 477 0.843983314 -0.634200317
## 478 1.716402630 -1.145230740
## 479 0.752960432 -0.862533059
## 480 0.063987232 -0.123169893
## 481 -0.267896200 0.050797911
## 482 -0.688001809 0.126908825
## 483 -0.790227508 0.268257666
## 484 -0.312707465 -0.079677942
## 485 0.096195329 -0.210153795
## 486 -0.290301832 -0.144915868
## 487 0.325853062 -0.373248611
## 488 -0.168471205 -0.210153795
## 489 0.757161488 -0.797295133
## 490 1.584769539 -1.688880128
## 491 2.384370549 -1.569277262
## 492 0.758561840 -0.971262937
## 493 0.097595681 -0.264518733
## 494 -0.090051492 -0.079677942
## 495 0.131204129 0.213892727
## 496 0.692745294 0.061670899
## 497 1.188469914 -0.308010684
## 498 0.202622083 -0.460232513
## 499 0.037380543 -0.144915868
## 500 0.342657286 -0.547216415
## 501 0.234830180 -0.623327329
## 502 -0.417733867 -0.014440015
## 503 -0.500354637 -0.210153795
## 504 -0.982075736 0.148654801
## 505 -0.864446166 -0.057931966
## 506 -0.668396881 -1.156103728
boston_scaled <- as.data.frame(scale(Boston))
boston_scaled$crim <- as.numeric(boston_scaled$crim)
# create a quantile vector of crim and print it
bins <- quantile(boston_scaled$crim)
bins
## 0% 25% 50% 75% 100%
## -0.419366929 -0.410563278 -0.390280295 0.007389247 9.924109610
#Create a categorical variable of the crime rate
crime <- cut(boston_scaled$crim,
breaks = bins,
include.lowest = TRUE,
label = c("low", "medium_low", "medium_high", "high"))
summary(crime)
## low medium_low medium_high high
## 127 126 126 127
# remove original crim from the dataset
boston_scaled <- dplyr::select(boston_scaled, -crim)
# add the new categorical value to scaled data
boston_scaled <- data.frame(boston_scaled, crime)
Here begins the splitting of the data into a training set and a test set, with a split ratio of 80% of the training set data and 20% of the test set data.
# number of rows in the Boston dataset
n <- nrow(boston_scaled)
# choose randomly 80% of the rows
ind <- sample(n, size = n * 0.8)
# create train set
train <- boston_scaled[ind,]
# create test set
test <- boston_scaled[-ind,]
# save the correct classes from test data
correct_classes <- boston_scaled$crime
# remove the crime variable from test data
test <- dplyr::select(test, -crime)
summary(train)
## zn indus chas nox
## Min. :-0.48724 Min. :-1.55630 Min. :-0.27233 Min. :-1.42991
## 1st Qu.:-0.48724 1st Qu.:-0.87558 1st Qu.:-0.27233 1st Qu.:-0.92076
## Median :-0.48724 Median :-0.37560 Median :-0.27233 Median :-0.23037
## Mean : 0.01009 Mean :-0.03768 Mean : 0.02003 Mean :-0.03642
## 3rd Qu.: 0.28991 3rd Qu.: 1.01499 3rd Qu.:-0.27233 3rd Qu.: 0.51179
## Max. : 3.80047 Max. : 2.42017 Max. : 3.66477 Max. : 2.72965
## rm age dis rad
## Min. :-3.44659 Min. :-2.33313 Min. :-1.26582 Min. :-0.98187
## 1st Qu.:-0.56451 1st Qu.:-0.95119 1st Qu.:-0.79695 1st Qu.:-0.63733
## Median :-0.05001 Median : 0.21582 Median :-0.25055 Median :-0.52248
## Mean : 0.02716 Mean :-0.03974 Mean : 0.01816 Mean :-0.05713
## 3rd Qu.: 0.49439 3rd Qu.: 0.90146 3rd Qu.: 0.70867 3rd Qu.:-0.17794
## Max. : 3.55153 Max. : 1.11639 Max. : 3.95660 Max. : 1.65960
## tax ptratio black lstat
## Min. :-1.3127 Min. :-2.70470 Min. :-3.87923 Min. :-1.52961
## 1st Qu.:-0.7787 1st Qu.:-0.68387 1st Qu.: 0.21900 1st Qu.:-0.84169
## Median :-0.4701 Median : 0.18221 Median : 0.38327 Median :-0.24899
## Mean :-0.0465 Mean :-0.02759 Mean : 0.03728 Mean :-0.03607
## 3rd Qu.: 0.2181 3rd Qu.: 0.80578 3rd Qu.: 0.43248 3rd Qu.: 0.55341
## Max. : 1.7964 Max. : 1.63721 Max. : 0.44062 Max. : 3.54526
## medv crime
## Min. :-1.90634 low :104
## 1st Qu.:-0.55809 medium_low :107
## Median :-0.09599 medium_high:103
## Mean : 0.03984 high : 90
## 3rd Qu.: 0.32534
## Max. : 2.98650
summary(test)
## zn indus chas nox
## Min. :-0.48724 Min. :-1.4018 Min. :-0.27233 Min. :-1.4644
## 1st Qu.:-0.48724 1st Qu.:-0.7932 1st Qu.:-0.27233 1st Qu.:-0.7827
## Median :-0.48724 Median : 0.3263 Median :-0.27233 Median :-0.1182
## Mean :-0.03997 Mean : 0.1492 Mean :-0.07933 Mean : 0.1443
## 3rd Qu.:-0.48724 3rd Qu.: 1.0150 3rd Qu.:-0.27233 3rd Qu.: 1.1633
## Max. : 3.58609 Max. : 2.1155 Max. : 3.66477 Max. : 2.7296
## rm age dis rad
## Min. :-3.8764 Min. :-1.8749 Min. :-1.24706 Min. :-0.9819
## 1st Qu.:-0.5766 1st Qu.:-0.5036 1st Qu.:-0.87223 1st Qu.:-0.6373
## Median :-0.2379 Median : 0.4787 Median :-0.44092 Median :-0.5225
## Mean :-0.1076 Mean : 0.1574 Mean :-0.07194 Mean : 0.2263
## 3rd Qu.: 0.2443 3rd Qu.: 0.9139 3rd Qu.: 0.43181 3rd Qu.: 1.6596
## Max. : 2.9751 Max. : 1.1164 Max. : 3.28405 Max. : 1.6596
## tax ptratio black lstat
## Min. :-1.3068 Min. :-2.7047 Min. :-3.90333 Min. :-1.49460
## 1st Qu.:-0.7015 1st Qu.:-0.3028 1st Qu.: 0.09114 1st Qu.:-0.58893
## Median :-0.1023 Median : 0.5517 Median : 0.36756 Median : 0.05418
## Mean : 0.1842 Mean : 0.1093 Mean :-0.14766 Mean : 0.14286
## 3rd Qu.: 1.5294 3rd Qu.: 0.8058 3rd Qu.: 0.44062 3rd Qu.: 0.72180
## Max. : 1.5294 Max. : 1.2677 Max. : 0.44062 Max. : 2.99212
## medv
## Min. :-1.90634
## 1st Qu.:-0.91962
## Median :-0.23734
## Mean :-0.15781
## 3rd Qu.: 0.06983
## Max. : 2.98650
nrow(train)
## [1] 404
nrow(test)
## [1] 102
4.Fit the linear discriminant analysis on the train set. Use the categorical crime rate as the target variable and all the other variables in the dataset as predictor variables.
# linear discriminant analysis
lda.fit <- lda(crime ~., data = train)
# print the lda.fit object
lda.fit
## Call:
## lda(crime ~ ., data = train)
##
## Prior probabilities of groups:
## low medium_low medium_high high
## 0.2574257 0.2648515 0.2549505 0.2227723
##
## Group means:
## zn indus chas nox rm
## low 0.92667462 -0.9075068 -0.083045403 -0.8573768 0.48244109
## medium_low -0.08952469 -0.3008146 -0.014761763 -0.5566191 -0.13490123
## medium_high -0.37734151 0.1920304 0.186362222 0.3810018 0.08592919
## high -0.48724019 1.0173916 -0.009855719 1.0529729 -0.37352561
## age dis rad tax ptratio black
## low -0.8750490 0.8382480 -0.6947544 -0.7411438 -0.42182396 0.3875640
## medium_low -0.3786327 0.3487745 -0.5396577 -0.4414222 -0.06018625 0.3234368
## medium_high 0.3628025 -0.3718571 -0.3909124 -0.2966951 -0.29920689 0.1063241
## high 0.8677118 -0.8761908 1.6353575 1.5120742 0.77755088 -0.7867161
## lstat medv
## low -0.804311818 0.55555546
## medium_low -0.138631929 -0.01626912
## medium_high 0.009699798 0.18380728
## high 0.921236068 -0.65413413
##
## Coefficients of linear discriminants:
## LD1 LD2 LD3
## zn 0.096839438 0.708480304 -0.9515761
## indus 0.003268679 -0.352029108 0.1835904
## chas -0.073261998 -0.006963925 0.1228697
## nox 0.412626040 -0.730228820 -1.2780645
## rm -0.071745585 -0.056208521 -0.1292698
## age 0.279320295 -0.214769866 -0.1626182
## dis -0.057277936 -0.261442982 0.2002652
## rad 2.999099874 0.828856469 -0.2302545
## tax -0.060794191 0.142282445 0.8078329
## ptratio 0.112870581 0.066923816 -0.2835724
## black -0.165829572 0.015733646 0.1806925
## lstat 0.245910553 -0.275867823 0.3465201
## medv 0.195334063 -0.460373155 -0.2654702
##
## Proportion of trace:
## LD1 LD2 LD3
## 0.9429 0.0408 0.0162
# the function for lda biplot arrows
lda.arrows <- function(x, myscale = 1, arrow_heads = 0.1, color = "red", tex = 0.75, choices = c(1,2)){
heads <- coef(x)
arrows(x0 = 0, y0 = 0,
x1 = myscale * heads[,choices[1]],
y1 = myscale * heads[,choices[2]], col=color, length = arrow_heads)
text(myscale * heads[,choices], labels = row.names(heads),
cex = tex, col=color, pos=3)
}
# target classes as numeric
classes <- as.numeric(train$crime)
# plot the lda results
plot(lda.fit, dimen = 2)
lda.arrows(lda.fit, myscale = 1)
In this graph, the clustering of crime levels can be clearly seen, with
low and medium_low crime rates concentrated in the top left and middle
left; medium_high and high crime rates are concentrated in the bottom
left and right. The concentration of low crime is much greater, and
there is a very clear demarcation line between high crime on the right
and the left. In the red part of the graph, rad(index of accessibility
to radial highway) is associated with high crime rates and zn(proportion
of residential land zoned for lots over 25,000 sq.ft) is closely related
to low crime rates.
# predict classes with test data
lda.pred <- predict(lda.fit, newdata = test)
# cross tabulate the results
predictions <- lda.pred$class
#table(correct = correct_classes, predicted = predictions)
6.Calculate the distances between the observations. Run k-means algorithm on the dataset.
library(MASS)
#reload the Boston dataset and standardize the detaset
data("Boston")
boston_scaled <- as.data.frame(scale(Boston))
#calculate the distances between the observations
dist <- dist(boston_scaled)
summary(dist)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.1343 3.4625 4.8241 4.9111 6.1863 14.3970
k-means
set.seed(13)
km <- kmeans(Boston, centers = 4)
# plot the Boston dataset with clusters
km <- kmeans(Boston, centers = 4)
# plot the Boston dataset with clusters
pairs(Boston[6:10], col = km$cluster)
pairs(Boston[1:5], col = km$cluster)
pairs(Boston[11:14], col = km$cluster)
set.seed(123)
# determine the number of clusters
k_max <- 10
# calculate the total within sum of squares
twcss <- sapply(1:k_max, function(k){kmeans(boston_scaled, k)$tot.withinss})
# visualize the results
qplot(x = 1:k_max, y = twcss, geom = 'line')
# k-means clustering
km <- kmeans(Boston, centers = 2)
# plot the Boston dataset with clusters
pairs(Boston, col = km$cluster)
The optimal number of clusters can be found by looking at the sum of
squares within clusters, and in the graph above I think the optimal
number of clusters is close to 2. At an optimal cluster number of 2, the
values vary significantly.
Prepare some package
library(dplyr)
library(tidyverse)
library(GGally)
Read data
human <- read.table("human.txt", sep = ",", )
dim(human)
## [1] 155 8
The dataset has 155 observations and 8 variables.
ggpairs(human)
summary(human)
## edu_fm labour_fm edu.exp life.exp
## Min. :0.1717 Min. :0.1857 Min. : 5.40 Min. :49.00
## 1st Qu.:0.7264 1st Qu.:0.5984 1st Qu.:11.25 1st Qu.:66.30
## Median :0.9375 Median :0.7535 Median :13.50 Median :74.20
## Mean :0.8529 Mean :0.7074 Mean :13.18 Mean :71.65
## 3rd Qu.:0.9968 3rd Qu.:0.8535 3rd Qu.:15.20 3rd Qu.:77.25
## Max. :1.4967 Max. :1.0380 Max. :20.20 Max. :83.50
## gni maternal.mortality.ratio teen.birth per.pa
## Min. : 581 Min. : 1.0 Min. : 0.60 Min. : 0.00
## 1st Qu.: 4198 1st Qu.: 11.5 1st Qu.: 12.65 1st Qu.:12.40
## Median : 12040 Median : 49.0 Median : 33.60 Median :19.30
## Mean : 17628 Mean : 149.1 Mean : 47.16 Mean :20.91
## 3rd Qu.: 24512 3rd Qu.: 190.0 3rd Qu.: 71.95 3rd Qu.:27.95
## Max. :123124 Max. :1100.0 Max. :204.80 Max. :57.50
The correlation between the variables can be seen very clearly in the visual charts. Take the variable of the labour market participation of females and males (labour_fm) as an example, there is a strong correlation between it and the percentage of parliamentary representation (per.pa), maternal mortality rate (maternal.mortality.ratio). As can be seen from the scatter plot, there appears to be a positive correlation between labour_fm and per.pa and maternal.mortality.ratio.
# Access corrplot
library(corrplot)
# compute the correlation matrix and visualize it with corrplot
cor(human) %>%
corrplot(method = "number")
In a heat map, the degree of correlation and correlations between
variables can be seen more visually through the figures.
2-3Perform principal component analysis (PCA) on the raw (non-standardized) human data.
# standardize the variables
human_std <- scale(human)
# print out summaries of the standardized variables
summary(human_std)
## edu_fm labour_fm edu.exp life.exp
## Min. :-2.8189 Min. :-2.6247 Min. :-2.7378 Min. :-2.7188
## 1st Qu.:-0.5233 1st Qu.:-0.5484 1st Qu.:-0.6782 1st Qu.:-0.6425
## Median : 0.3503 Median : 0.2316 Median : 0.1140 Median : 0.3056
## Mean : 0.0000 Mean : 0.0000 Mean : 0.0000 Mean : 0.0000
## 3rd Qu.: 0.5958 3rd Qu.: 0.7350 3rd Qu.: 0.7126 3rd Qu.: 0.6717
## Max. : 2.6646 Max. : 1.6632 Max. : 2.4730 Max. : 1.4218
## gni maternal.mortality.ratio teen.birth per.pa
## Min. :-0.9193 Min. :-0.6992 Min. :-1.1325 Min. :-1.8203
## 1st Qu.:-0.7243 1st Qu.:-0.6496 1st Qu.:-0.8394 1st Qu.:-0.7409
## Median :-0.3013 Median :-0.4726 Median :-0.3298 Median :-0.1403
## Mean : 0.0000 Mean : 0.0000 Mean : 0.0000 Mean : 0.0000
## 3rd Qu.: 0.3712 3rd Qu.: 0.1932 3rd Qu.: 0.6030 3rd Qu.: 0.6127
## Max. : 5.6890 Max. : 4.4899 Max. : 3.8344 Max. : 3.1850
# perform principal component analysis (with the SVD method)
pca_human <- prcomp(human)
pca_human_std <- prcomp(human_std)
# print out summaries of the standardized variables
summary(pca_human_std)
## Importance of components:
## PC1 PC2 PC3 PC4 PC5 PC6 PC7
## Standard deviation 2.071 1.1397 0.87505 0.77886 0.66196 0.53631 0.45900
## Proportion of Variance 0.536 0.1624 0.09571 0.07583 0.05477 0.03595 0.02634
## Cumulative Proportion 0.536 0.6984 0.79413 0.86996 0.92473 0.96069 0.98702
## PC8
## Standard deviation 0.32224
## Proportion of Variance 0.01298
## Cumulative Proportion 1.00000
summary(pca_human)
## Importance of components:
## PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8
## Standard deviation 1.854e+04 185.5219 25.19 11.45 3.766 1.566 0.1912 0.1591
## Proportion of Variance 9.999e-01 0.0001 0.00 0.00 0.000 0.000 0.0000 0.0000
## Cumulative Proportion 9.999e-01 1.0000 1.00 1.00 1.000 1.000 1.0000 1.0000
# draw a biplot of the principal component representation and the original variables
biplot(pca_human,
choices = 1:2,
cex = c(0.8, 1),
col = c("grey40", "deeppink2"))
## Warning in arrows(0, 0, y[, 1L] * 0.8, y[, 2L] * 0.8, col = col[2L], length =
## arrow.len): zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(0, 0, y[, 1L] * 0.8, y[, 2L] * 0.8, col = col[2L], length =
## arrow.len): zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(0, 0, y[, 1L] * 0.8, y[, 2L] * 0.8, col = col[2L], length =
## arrow.len): zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(0, 0, y[, 1L] * 0.8, y[, 2L] * 0.8, col = col[2L], length =
## arrow.len): zero-length arrow is of indeterminate angle and so skipped
## Warning in arrows(0, 0, y[, 1L] * 0.8, y[, 2L] * 0.8, col = col[2L], length =
## arrow.len): zero-length arrow is of indeterminate angle and so skipped
biplot(pca_human_std,
choices = 1:2,
cex = c(0.8, 1),
col = c("grey40", "deeppink2"))
4.Give personal interpretations of the first two principal component
dimensions based on the biplot drawn after PCA on the standardized human
data
In this figure, the countries on the left are more concentrated, with an increase in educational expectations, life expectancy and the level of primary education attained by both men and women in this region, with a number of European or East Asian countries. In contrast, the number of women in parliament and the ratio of men to women in the labour market are concentrated at the top of the graph, mostly in the Nordic countries. Finally, the high maternal mortality and adolescent birth rates point to the countries on the right, which are mostly African countries.
#read data
tea <- read.csv("https://raw.githubusercontent.com/KimmoVehkalahti/Helsinki-Open-Data-Science/master/datasets/tea.csv", stringsAsFactors = TRUE)
#explore the data
str(tea); dim(tea)
## 'data.frame': 300 obs. of 36 variables:
## $ breakfast : Factor w/ 2 levels "breakfast","Not.breakfast": 1 1 2 2 1 2 1 2 1 1 ...
## $ tea.time : Factor w/ 2 levels "Not.tea time",..: 1 1 2 1 1 1 2 2 2 1 ...
## $ evening : Factor w/ 2 levels "evening","Not.evening": 2 2 1 2 1 2 2 1 2 1 ...
## $ lunch : Factor w/ 2 levels "lunch","Not.lunch": 2 2 2 2 2 2 2 2 2 2 ...
## $ dinner : Factor w/ 2 levels "dinner","Not.dinner": 2 2 1 1 2 1 2 2 2 2 ...
## $ always : Factor w/ 2 levels "always","Not.always": 2 2 2 2 1 2 2 2 2 2 ...
## $ home : Factor w/ 2 levels "home","Not.home": 1 1 1 1 1 1 1 1 1 1 ...
## $ work : Factor w/ 2 levels "Not.work","work": 1 1 2 1 1 1 1 1 1 1 ...
## $ tearoom : Factor w/ 2 levels "Not.tearoom",..: 1 1 1 1 1 1 1 1 1 2 ...
## $ friends : Factor w/ 2 levels "friends","Not.friends": 2 2 1 2 2 2 1 2 2 2 ...
## $ resto : Factor w/ 2 levels "Not.resto","resto": 1 1 2 1 1 1 1 1 1 1 ...
## $ pub : Factor w/ 2 levels "Not.pub","pub": 1 1 1 1 1 1 1 1 1 1 ...
## $ Tea : Factor w/ 3 levels "black","Earl Grey",..: 1 1 2 2 2 2 2 1 2 1 ...
## $ How : Factor w/ 4 levels "alone","lemon",..: 1 3 1 1 1 1 1 3 3 1 ...
## $ sugar : Factor w/ 2 levels "No.sugar","sugar": 2 1 1 2 1 1 1 1 1 1 ...
## $ how : Factor w/ 3 levels "tea bag","tea bag+unpackaged",..: 1 1 1 1 1 1 1 1 2 2 ...
## $ where : Factor w/ 3 levels "chain store",..: 1 1 1 1 1 1 1 1 2 2 ...
## $ price : Factor w/ 6 levels "p_branded","p_cheap",..: 4 6 6 6 6 3 6 6 5 5 ...
## $ age : int 39 45 47 23 48 21 37 36 40 37 ...
## $ sex : Factor w/ 2 levels "F","M": 2 1 1 2 2 2 2 1 2 2 ...
## $ SPC : Factor w/ 7 levels "employee","middle",..: 2 2 4 6 1 6 5 2 5 5 ...
## $ Sport : Factor w/ 2 levels "Not.sportsman",..: 2 2 2 1 2 2 2 2 2 1 ...
## $ age_Q : Factor w/ 5 levels "+60","15-24",..: 4 5 5 2 5 2 4 4 4 4 ...
## $ frequency : Factor w/ 4 levels "+2/day","1 to 2/week",..: 3 3 1 3 1 3 4 2 1 1 ...
## $ escape.exoticism: Factor w/ 2 levels "escape-exoticism",..: 2 1 2 1 1 2 2 2 2 2 ...
## $ spirituality : Factor w/ 2 levels "Not.spirituality",..: 1 1 1 2 2 1 1 1 1 1 ...
## $ healthy : Factor w/ 2 levels "healthy","Not.healthy": 1 1 1 1 2 1 1 1 2 1 ...
## $ diuretic : Factor w/ 2 levels "diuretic","Not.diuretic": 2 1 1 2 1 2 2 2 2 1 ...
## $ friendliness : Factor w/ 2 levels "friendliness",..: 2 2 1 2 1 2 2 1 2 1 ...
## $ iron.absorption : Factor w/ 2 levels "iron absorption",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ feminine : Factor w/ 2 levels "feminine","Not.feminine": 2 2 2 2 2 2 2 1 2 2 ...
## $ sophisticated : Factor w/ 2 levels "Not.sophisticated",..: 1 1 1 2 1 1 1 2 2 1 ...
## $ slimming : Factor w/ 2 levels "No.slimming",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ exciting : Factor w/ 2 levels "exciting","No.exciting": 2 1 2 2 2 2 2 2 2 2 ...
## $ relaxing : Factor w/ 2 levels "No.relaxing",..: 1 1 2 2 2 2 2 2 2 2 ...
## $ effect.on.health: Factor w/ 2 levels "effect on health",..: 2 2 2 2 2 2 2 2 2 2 ...
## [1] 300 36
Tea dataset has 300 observations and 36 varibales, and all the variables are categorical.
#convert all variables to factors
tea$Tea <- factor(tea$Tea)
tea$How <- factor(tea$How)
tea$how <- factor(tea$how)
tea$sugar <- factor(tea$sugar)
tea$where <- factor(tea$where)
tea$lunch <- factor(tea$lunch)
library(dplyr)
library(tidyr)
# column names to keep in the dataset
keep_columns <- c("Tea", "How", "how", "sugar", "where", "lunch")
# select the 'keep_columns' to create a new dataset
tea_time <- dplyr::select(tea, keep_columns)
## Warning: Using an external vector in selections was deprecated in tidyselect 1.1.0.
## ℹ Please use `all_of()` or `any_of()` instead.
## # Was:
## data %>% select(keep_columns)
##
## # Now:
## data %>% select(all_of(keep_columns))
##
## See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
# look at the summaries and structure of the data
summary(tea_time)
## Tea How how sugar
## black : 74 alone:195 tea bag :170 No.sugar:155
## Earl Grey:193 lemon: 33 tea bag+unpackaged: 94 sugar :145
## green : 33 milk : 63 unpackaged : 36
## other: 9
## where lunch
## chain store :192 lunch : 44
## chain store+tea shop: 78 Not.lunch:256
## tea shop : 30
##
str(tea_time)
## 'data.frame': 300 obs. of 6 variables:
## $ Tea : Factor w/ 3 levels "black","Earl Grey",..: 1 1 2 2 2 2 2 1 2 1 ...
## $ How : Factor w/ 4 levels "alone","lemon",..: 1 3 1 1 1 1 1 3 3 1 ...
## $ how : Factor w/ 3 levels "tea bag","tea bag+unpackaged",..: 1 1 1 1 1 1 1 1 2 2 ...
## $ sugar: Factor w/ 2 levels "No.sugar","sugar": 2 1 1 2 1 1 1 1 1 1 ...
## $ where: Factor w/ 3 levels "chain store",..: 1 1 1 1 1 1 1 1 2 2 ...
## $ lunch: Factor w/ 2 levels "lunch","Not.lunch": 2 2 2 2 2 2 2 2 2 2 ...
# visualize the dataset
library(ggplot2)
pivot_longer(tea_time, cols = everything()) %>%
ggplot(aes(value)) +
facet_wrap("name", scales = "free") +
geom_bar() +
theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 8))
In tea dataset, I choose 6 variables, The frequency distribution chart
gives a very visual indication of the number of times each of the six
variables was answered.
# multiple correspondence analysis
library(FactoMineR)
mca <- MCA(tea_time, graph = FALSE)
# summary of the model
summary(mca)
##
## Call:
## MCA(X = tea_time, graph = FALSE)
##
##
## Eigenvalues
## Dim.1 Dim.2 Dim.3 Dim.4 Dim.5 Dim.6 Dim.7
## Variance 0.279 0.261 0.219 0.189 0.177 0.156 0.144
## % of var. 15.238 14.232 11.964 10.333 9.667 8.519 7.841
## Cumulative % of var. 15.238 29.471 41.435 51.768 61.434 69.953 77.794
## Dim.8 Dim.9 Dim.10 Dim.11
## Variance 0.141 0.117 0.087 0.062
## % of var. 7.705 6.392 4.724 3.385
## Cumulative % of var. 85.500 91.891 96.615 100.000
##
## Individuals (the 10 first)
## Dim.1 ctr cos2 Dim.2 ctr cos2 Dim.3
## 1 | -0.298 0.106 0.086 | -0.328 0.137 0.105 | -0.327
## 2 | -0.237 0.067 0.036 | -0.136 0.024 0.012 | -0.695
## 3 | -0.369 0.162 0.231 | -0.300 0.115 0.153 | -0.202
## 4 | -0.530 0.335 0.460 | -0.318 0.129 0.166 | 0.211
## 5 | -0.369 0.162 0.231 | -0.300 0.115 0.153 | -0.202
## 6 | -0.369 0.162 0.231 | -0.300 0.115 0.153 | -0.202
## 7 | -0.369 0.162 0.231 | -0.300 0.115 0.153 | -0.202
## 8 | -0.237 0.067 0.036 | -0.136 0.024 0.012 | -0.695
## 9 | 0.143 0.024 0.012 | 0.871 0.969 0.435 | -0.067
## 10 | 0.476 0.271 0.140 | 0.687 0.604 0.291 | -0.650
## ctr cos2
## 1 0.163 0.104 |
## 2 0.735 0.314 |
## 3 0.062 0.069 |
## 4 0.068 0.073 |
## 5 0.062 0.069 |
## 6 0.062 0.069 |
## 7 0.062 0.069 |
## 8 0.735 0.314 |
## 9 0.007 0.003 |
## 10 0.643 0.261 |
##
## Categories (the 10 first)
## Dim.1 ctr cos2 v.test Dim.2 ctr cos2
## black | 0.473 3.288 0.073 4.677 | 0.094 0.139 0.003
## Earl Grey | -0.264 2.680 0.126 -6.137 | 0.123 0.626 0.027
## green | 0.486 1.547 0.029 2.952 | -0.933 6.111 0.107
## alone | -0.018 0.012 0.001 -0.418 | -0.262 2.841 0.127
## lemon | 0.669 2.938 0.055 4.068 | 0.531 1.979 0.035
## milk | -0.337 1.420 0.030 -3.002 | 0.272 0.990 0.020
## other | 0.288 0.148 0.003 0.876 | 1.820 6.347 0.102
## tea bag | -0.608 12.499 0.483 -12.023 | -0.351 4.459 0.161
## tea bag+unpackaged | 0.350 2.289 0.056 4.088 | 1.024 20.968 0.478
## unpackaged | 1.958 27.432 0.523 12.499 | -1.015 7.898 0.141
## v.test Dim.3 ctr cos2 v.test
## black 0.929 | -1.081 21.888 0.382 -10.692 |
## Earl Grey 2.867 | 0.433 9.160 0.338 10.053 |
## green -5.669 | -0.108 0.098 0.001 -0.659 |
## alone -6.164 | -0.113 0.627 0.024 -2.655 |
## lemon 3.226 | 1.329 14.771 0.218 8.081 |
## milk 2.422 | 0.013 0.003 0.000 0.116 |
## other 5.534 | -2.524 14.526 0.197 -7.676 |
## tea bag -6.941 | -0.065 0.183 0.006 -1.287 |
## tea bag+unpackaged 11.956 | 0.019 0.009 0.000 0.226 |
## unpackaged -6.482 | 0.257 0.602 0.009 1.640 |
##
## Categorical variables (eta2)
## Dim.1 Dim.2 Dim.3
## Tea | 0.126 0.108 0.410 |
## How | 0.076 0.190 0.394 |
## how | 0.708 0.522 0.010 |
## sugar | 0.065 0.001 0.336 |
## where | 0.702 0.681 0.055 |
## lunch | 0.000 0.064 0.111 |
# visualize MCA
plot(mca, invisible=c("ind"), graph.type = "classic", habillage = "quali")
In the Mac factor map, different colours indicate different variables.
Red indicates how the tea is drunk, with lemon, milk, other or nothing.
Green indicates how the tea is packaged. Pink indicates where the tea
was purchased. Yellow indicates whether the tea was consumed before or
after lunch. Black indicates the variety of tea. Blue indicates whether
or not sugar was added. In the map we can observe that Earl Grey tea is
usually served with milk and sugar and is usually served at breakfast
time; black tea is served with lemon; green tea is usually bought
unpackaged from a tea shop and is usually served at breakfast or after
lunch.
Exercise 1 In this exercise, I will use the RATS dataset, and implement the analyses of Chapter 8 of MABS. Prepare the packages
library(dplyr)
library(tidyr)
read the RATS data set
RATS <- read.table("data/ratsl.txt", sep = ",", header = T)
RATS$ID <- factor(RATS$ID)
RATS$Group <- factor(RATS$Group)
glimpse(RATS)
## Rows: 176
## Columns: 5
## $ ID <fct> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3,…
## $ Group <fct> 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 1, 1, …
## $ WD <chr> "WD1", "WD1", "WD1", "WD1", "WD1", "WD1", "WD1", "WD1", "WD1", …
## $ Weight <int> 240, 225, 245, 260, 255, 260, 275, 245, 410, 405, 445, 555, 470…
## $ Time <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 8, 8, 8, …
The dataset has 176 rows and 5 columns.
# Plot the RATSL data
library(ggplot2)
ggplot(RATS, aes(x = Time, y = Weight, group = ID)) +
geom_line(aes(linetype = Group))+
scale_x_continuous(name = "Time(days)", breaks = seq(0, 60, 10))+
scale_y_continuous(name = "Weight (grams)")+
theme(legend.position = "top")
In the visualisation, it can be seen very visually that the weight of
each rat increases slightly with time. Next the weights were
standardised and the search for the presence of this change
continued.
library(dplyr)
library(tidyr)
# Standardise the variable bprs
RATS_std <- RATS %>%
group_by(ID) %>%
mutate(stdweight = (Weight - mean(Weight))/sd(Weight)) %>%
ungroup()
# Glimpse the data
glimpse(RATS_std)
## Rows: 176
## Columns: 6
## $ ID <fct> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2,…
## $ Group <fct> 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 1, …
## $ WD <chr> "WD1", "WD1", "WD1", "WD1", "WD1", "WD1", "WD1", "WD1", "WD1…
## $ Weight <int> 240, 225, 245, 260, 255, 260, 275, 245, 410, 405, 445, 555, …
## $ Time <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 8, 8, …
## $ stdweight <dbl> -2.02487690, -1.73484555, -1.76767584, -0.90187616, -1.63589…
# Plot again with the standardised bprs
library(ggplot2)
ggplot(RATS_std, aes(x = Time, y = stdweight, linetype = Group)) +
geom_line() +
scale_x_continuous(name = "Time (days)", breaks = seq(0, 64, 7)) +
facet_grid(. ~ Group, labeller = label_both) +
scale_y_continuous(name = "standardized weight")
After standardizing the data, it is easy to see that the weighting
increases gradually.
Then summary measure analysis of the data set
# Number of subjects (per group):
n <- 11
library(dplyr)
library(tidyr)
# Summary data with mean and standard error of Weight by Group and Time
RATSS <- RATS %>%
group_by(Group, Time) %>%
summarise( mean = mean(Weight), se = sd(Weight)/sqrt(n) ) %>%
ungroup()
## `summarise()` has grouped output by 'Group'. You can override using the
## `.groups` argument.
# Glimpse the data
glimpse(RATSS)
## Rows: 33
## Columns: 4
## $ Group <fct> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2…
## $ Time <int> 1, 8, 15, 22, 29, 36, 43, 44, 50, 57, 64, 1, 8, 15, 22, 29, 36, …
## $ mean <dbl> 250.625, 255.000, 254.375, 261.875, 264.625, 265.000, 267.375, 2…
## $ se <dbl> 4.589478, 3.947710, 3.460116, 4.100800, 3.333956, 3.552939, 3.30…
# Plot the mean profiles
library(ggplot2)
ggplot(RATSS, aes(x = Time, y = mean, col = Group)) +
geom_line() +
#geom_errorbar(aes(ymin=mean-se, ymax=mean+se), width=0.3) +
theme(legend.position = "right") +
scale_y_continuous(name = "mean(Weight) +/- se(Weight)") +
scale_x_continuous(name = "Time (days)", breaks = seq(1, 64, 7))
Applying the summary measure approach
library(dplyr)
library(tidyr)
# Summary data with mean and standard error of rats by treatment and week
RATSS1 <- RATS %>%
group_by(Group, ID) %>%
summarise( mean=mean(Weight) ) %>%
ungroup()
## `summarise()` has grouped output by 'Group'. You can override using the
## `.groups` argument.
# Glimpse the data
glimpse(RATSS)
## Rows: 33
## Columns: 4
## $ Group <fct> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2…
## $ Time <int> 1, 8, 15, 22, 29, 36, 43, 44, 50, 57, 64, 1, 8, 15, 22, 29, 36, …
## $ mean <dbl> 250.625, 255.000, 254.375, 261.875, 264.625, 265.000, 267.375, 2…
## $ se <dbl> 4.589478, 3.947710, 3.460116, 4.100800, 3.333956, 3.552939, 3.30…
# Draw a boxplot of the mean versus treatment
library(ggplot2)
ggplot(RATSS1, aes(x = Group, y = mean)) +
geom_boxplot() +
stat_summary(fun = "mean", geom = "point", shape=23, size=4, fill = "white") +
scale_y_continuous(name = "mean(weight), days 1-64")
# Create a new data by filtering the outlier and adjust the ggplot code the draw the plot again with the new data
RATSS2 <- RATSS %>%
filter(mean < 580)
library(ggplot2)
ggplot(RATSS2, aes(x = Group, y = mean))+
geom_boxplot()+
stat_summary(fun = "mean", geom = "point", shape = 23, size = 4, fill = "white")+
scale_y_continuous(name = "mean(weight), days 1-64")
Anova
library(dplyr)
library(tidyr)
# Add the baseline from the original data as a new variable to the summary data
RATSS3 <- RATSS %>%
mutate(baseline = RATS$day0)
# Fit the linear model with the mean as the response
fit <- lm(mean ~ Group, data = RATSS3)
# Compute the analysis of variance table for the fitted model with anova()
anova(fit)
## Analysis of Variance Table
##
## Response: mean
## Df Sum Sq Mean Sq F value Pr(>F)
## Group 2 437104 218552 1006.3 < 2.2e-16 ***
## Residuals 30 6516 217
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Exercise 2 In this exercise, I will use BPRS dataset. The explain of BPRS from MABS4IODS:“Here 40 male subjects were randomly assigned to one of two treatment groups and each subject was rated on the brief psychiatric rating scale (BPRS) measured before treatment be- gan (week 0) and then at weekly intervals for eight weeks. The BPRS assesses the level of 18 symptom constructs such as hostility, suspiciousness, halluci- nations and grandiosity; each of these is rated from one (not present) to seven (extremely severe). The scale is used to evaluate patients suspected of having schizophrenia.”
read the data set
BPRS <- read.table("data/bprsl.txt", sep = ",", header = T)
# Access the packages dplyr and tidyr
library(dplyr)
library(tidyr)
# Extract the week number
BPRS <- BPRS %>%
mutate(week = as.integer(substr(BPRS$weeks, 5, 5)))
# Take a glimpse at the BPRSL data
glimpse(BPRS)
## Rows: 360
## Columns: 5
## $ treatment <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, …
## $ subject <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 1…
## $ weeks <chr> "week0", "week0", "week0", "week0", "week0", "week0", "week0…
## $ bprs <int> 42, 58, 54, 55, 72, 48, 71, 30, 41, 57, 30, 55, 36, 38, 66, …
## $ week <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
# Plot the data
library(ggplot2)
ggplot(BPRS, aes(x = week, y = bprs, group = subject)) +
geom_line() +
theme(legend.position = "top") +
facet_grid(. ~ treatment, labeller = label_both)
Holding on to independence: The Linear model
# create a regression model BPRS_reg
BPRS_reg <- lm(bprs ~ week + treatment, data = BPRS)
# print out a summary of the model
summary(BPRS_reg)
##
## Call:
## lm(formula = bprs ~ week + treatment, data = BPRS)
##
## Residuals:
## Min 1Q Median 3Q Max
## -22.454 -8.965 -3.196 7.002 50.244
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 45.8817 2.2949 19.993 <2e-16 ***
## week -2.2704 0.2524 -8.995 <2e-16 ***
## treatment 0.5722 1.3034 0.439 0.661
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 12.37 on 357 degrees of freedom
## Multiple R-squared: 0.1851, Adjusted R-squared: 0.1806
## F-statistic: 40.55 on 2 and 357 DF, p-value: < 2.2e-16
The Random Intercept Model
# access library lme4
library(lme4)
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
# Create a random intercept model
BPRS_ref <- lmer(bprs ~ week + treatment + (week | subject), data = BPRS, REML = FALSE)
# Print the summary of the model
summary(BPRS_ref)
## Linear mixed model fit by maximum likelihood ['lmerMod']
## Formula: bprs ~ week + treatment + (week | subject)
## Data: BPRS
##
## AIC BIC logLik deviance df.resid
## 2745.4 2772.6 -1365.7 2731.4 353
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.8919 -0.6194 -0.0691 0.5531 3.7976
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## subject (Intercept) 64.8222 8.0512
## week 0.9609 0.9802 -0.51
## Residual 97.4305 9.8707
## Number of obs: 360, groups: subject, 20
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 45.8817 2.5685 17.863
## week -2.2704 0.2977 -7.626
## treatment 0.5722 1.0405 0.550
##
## Correlation of Fixed Effects:
## (Intr) week
## week -0.477
## treatment -0.608 0.000
Slippery slopes: Random Intercept and Random Slope Model
# create a random intercept and random slope model
library(lme4)
BPRS_ref1 <- lmer(bprs ~ week + treatment + (week | subject), data = BPRS, REML = FALSE)
# print a summary of the model
summary(BPRS_ref1)
## Linear mixed model fit by maximum likelihood ['lmerMod']
## Formula: bprs ~ week + treatment + (week | subject)
## Data: BPRS
##
## AIC BIC logLik deviance df.resid
## 2745.4 2772.6 -1365.7 2731.4 353
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.8919 -0.6194 -0.0691 0.5531 3.7976
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## subject (Intercept) 64.8222 8.0512
## week 0.9609 0.9802 -0.51
## Residual 97.4305 9.8707
## Number of obs: 360, groups: subject, 20
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 45.8817 2.5685 17.863
## week -2.2704 0.2977 -7.626
## treatment 0.5722 1.0405 0.550
##
## Correlation of Fixed Effects:
## (Intr) week
## week -0.477
## treatment -0.608 0.000
# perform an ANOVA test on the two models
anova(BPRS_ref1, BPRS_ref)
## Data: BPRS
## Models:
## BPRS_ref1: bprs ~ week + treatment + (week | subject)
## BPRS_ref: bprs ~ week + treatment + (week | subject)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## BPRS_ref1 7 2745.4 2772.6 -1365.7 2731.4
## BPRS_ref 7 2745.4 2772.6 -1365.7 2731.4 0 0
Time to interact: Random Intercept and Random Slope Model with interaction
# create a random intercept and random slope model with the interaction
library(lme4)
BPRS_ref2 <- lmer(bprs ~ week + treatment + (week | subject) + week * treatment, data = BPRS, REML = FALSE)
# print a summary of the model
summary(BPRS_ref2)
## Linear mixed model fit by maximum likelihood ['lmerMod']
## Formula: bprs ~ week + treatment + (week | subject) + week * treatment
## Data: BPRS
##
## AIC BIC logLik deviance df.resid
## 2744.3 2775.4 -1364.1 2728.3 352
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.0513 -0.6271 -0.0768 0.5288 3.9260
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## subject (Intercept) 65.0049 8.0626
## week 0.9687 0.9842 -0.51
## Residual 96.4702 9.8219
## Number of obs: 360, groups: subject, 20
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 50.1767 3.5159 14.271
## week -3.3442 0.6711 -4.983
## treatment -2.2911 1.9090 -1.200
## week:treatment 0.7158 0.4010 1.785
##
## Correlation of Fixed Effects:
## (Intr) week trtmnt
## week -0.768
## treatment -0.814 0.753
## week:trtmnt 0.684 -0.896 -0.840
# perform an ANOVA test on the two models
anova(BPRS_ref2, BPRS_ref1)
## Data: BPRS
## Models:
## BPRS_ref1: bprs ~ week + treatment + (week | subject)
## BPRS_ref2: bprs ~ week + treatment + (week | subject) + week * treatment
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## BPRS_ref1 7 2745.4 2772.6 -1365.7 2731.4
## BPRS_ref2 8 2744.3 2775.4 -1364.1 2728.3 3.1712 1 0.07495 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# draw the plot of BPRS with the observed Weight values
library(ggplot2)
ggplot(BPRS, aes(x = week, y = bprs, group = subject)) +
geom_line(aes()) +
scale_x_continuous(name = "Time (weeks)") +
scale_y_continuous(name = "Observed BPRS") +
theme(legend.position = "top")
# Create a vector of the fitted values
Fitted <- fitted(BPRS_ref2)
library(dplyr)
library(tidyr)
# Create a new column fitted to RATSL
BPRS <- BPRS %>%
mutate(Fitted = Fitted)
# draw the plot of RATSL with the Fitted values of weight
library(ggplot2)
ggplot(BPRS, aes(x = week, y = Fitted, group = subject)) +
geom_line(aes()) +
scale_x_continuous(name = "Time (weeks)", breaks = seq(0, 60, 20)) +
scale_y_continuous(name = "Fitted BPRS") +
theme(legend.position = "top")